mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-14 20:50:44 +01:00
Geography: Add support for OSM node ids
This commit is contained in:
parent
1fb0bbd1c0
commit
faa6474271
@ -187,7 +187,7 @@ class GeographyLocaltimeTestCase(PluginTestCase):
|
|||||||
|
|
||||||
class GeographyWikidataTestCase(SupyTestCase):
|
class GeographyWikidataTestCase(SupyTestCase):
|
||||||
@skipIf(not network, "Network test")
|
@skipIf(not network, "Network test")
|
||||||
def testOsmidToTimezone(self):
|
def testRelationOsmidToTimezone(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
wikidata.uri_from_osmid(450381),
|
wikidata.uri_from_osmid(450381),
|
||||||
"http://www.wikidata.org/entity/Q22690",
|
"http://www.wikidata.org/entity/Q22690",
|
||||||
@ -196,6 +196,12 @@ class GeographyWikidataTestCase(SupyTestCase):
|
|||||||
wikidata.uri_from_osmid(192468),
|
wikidata.uri_from_osmid(192468),
|
||||||
"http://www.wikidata.org/entity/Q47045",
|
"http://www.wikidata.org/entity/Q47045",
|
||||||
)
|
)
|
||||||
|
@skipIf(not network, "Network test")
|
||||||
|
def testNodeOsmidToTimezone(self):
|
||||||
|
self.assertEqual(
|
||||||
|
wikidata.uri_from_osmid(436012592),
|
||||||
|
"http://www.wikidata.org/entity/Q933",
|
||||||
|
)
|
||||||
|
|
||||||
@skipIf(not network, "Network test")
|
@skipIf(not network, "Network test")
|
||||||
def testDirect(self):
|
def testDirect(self):
|
||||||
|
@ -115,7 +115,14 @@ LIMIT 1
|
|||||||
OSMID_QUERY = string.Template(
|
OSMID_QUERY = string.Template(
|
||||||
"""
|
"""
|
||||||
SELECT ?item WHERE {
|
SELECT ?item WHERE {
|
||||||
?item wdt:P402 "$osmid".
|
{
|
||||||
|
?item wdt:P402 "$osmid". # OSM relation ID
|
||||||
|
}
|
||||||
|
UNION
|
||||||
|
{
|
||||||
|
?item wdt:P11693 "$osmid". # OSM node ID
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user