jenkins-bot has submitted this change and it was merged.

Change subject: Add support for geographic coordinates to claimit.py
......................................................................


Add support for geographic coordinates to claimit.py

Change-Id: I4cae7e0bf3adca8674cfc7c4bb1eef8a330d461c
---
M scripts/claimit.py
1 file changed, 20 insertions(+), 2 deletions(-)

Approvals:
  Merlijn van Deen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/claimit.py b/scripts/claimit.py
index f326a4c..808b33d 100755
--- a/scripts/claimit.py
+++ b/scripts/claimit.py
@@ -7,9 +7,20 @@
 
 python claimit.py [pagegenerators] P1 Q2 P123 Q456
 
-You can use any typical pagegenerator to provide with a list of pages
-
+You can use any typical pagegenerator to provide with a list of pages.
 Then list the property-->target pairs to add.
+
+For geographic coordinates:
+
+python claimit.py [pagegenerators] P625 [lat-dec],[long-dec],[prec]
+
+[lat-dec] and [long-dec] represent the latitude and longitude respectively,
+and [prec] represents the precision. All values are in decimal degrees,
+not DMS. If [prec] is omitted, the default precision is 0.0001 degrees.
+
+Example:
+
+python claimit.py [pagegenerators] P625 -23.3991,-52.0910,0.0001
 """
 #
 # (C) Legoktm, 2013
@@ -111,6 +122,13 @@
             target = pywikibot.ItemPage(repo, commandline_claims[i + 1])
         elif claim.getType() == 'string':
             target = commandline_claims[i + 1]
+        elif claim.getType() == 'globecoordinate':
+            coord_args = map(float, commandline_claims[i + 1].split(','))
+            if len(coord_args) >= 3:
+                precision = coord_args[2]
+            else:
+                precision = 0.0001  # Default value (~10 m at equator)
+            target = pywikibot.Coordinate(coord_args[0], coord_args[1], 
precision=precision)
         else:
             raise NotImplementedError(
                 "%s datatype is not yet supported by claimit.py"

-- 
To view, visit https://gerrit.wikimedia.org/r/97453
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4cae7e0bf3adca8674cfc7c4bb1eef8a330d461c
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: Guoguo12 <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to