Skip to content

Commit faa6474

Browse files
committed
Geography: Add support for OSM node ids
1 parent 1fb0bbd commit faa6474

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

plugins/Geography/test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def testLocaltimeIntegration(self):
187187

188188
class GeographyWikidataTestCase(SupyTestCase):
189189
@skipIf(not network, "Network test")
190-
def testOsmidToTimezone(self):
190+
def testRelationOsmidToTimezone(self):
191191
self.assertEqual(
192192
wikidata.uri_from_osmid(450381),
193193
"http://www.wikidata.org/entity/Q22690",
@@ -196,6 +196,12 @@ def testOsmidToTimezone(self):
196196
wikidata.uri_from_osmid(192468),
197197
"http://www.wikidata.org/entity/Q47045",
198198
)
199+
@skipIf(not network, "Network test")
200+
def testNodeOsmidToTimezone(self):
201+
self.assertEqual(
202+
wikidata.uri_from_osmid(436012592),
203+
"http://www.wikidata.org/entity/Q933",
204+
)
199205

200206
@skipIf(not network, "Network test")
201207
def testDirect(self):

plugins/Geography/wikidata.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,14 @@
115115
OSMID_QUERY = string.Template(
116116
"""
117117
SELECT ?item WHERE {
118-
?item wdt:P402 "$osmid".
118+
{
119+
?item wdt:P402 "$osmid". # OSM relation ID
120+
}
121+
UNION
122+
{
123+
?item wdt:P11693 "$osmid". # OSM node ID
124+
}
125+
119126
}
120127
LIMIT 1
121128
"""

0 commit comments

Comments
 (0)