query-9fc9f4e0fd05d513b132b6d24230faf3
Finding geographic centers
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?territory ?territoryLabel ?location ?distance
WHERE {
SERVICE wikibase:around {
?territory wdt:P5140 ?location.
bd:serviceParam wikibase:center "Point(18.0 60.0)"^^geo:wktLiteral.
bd:serviceParam wikibase:radius "100000".
bd:serviceParam wikibase:distance ?distance.
}
#OPTIONAL {?item wdt:P31 ?class}.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ?distance
LIMIT 100
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?distance"):::projected
v3("?location"):::projected
v2("?territory"):::projected
c3(["bd:serviceParam"]):::iri
c5([sPoint(18.0 60.0)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal
c7(["100000"]):::literal
c11(["en"]):::literal
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v2 --"wdt:P5140"--> v3
c3 --"wikibase:center"--> c5
c3 --"wikibase:radius"--> c7
c3 --"wikibase:distance"--> v1
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c3 --"wikibase:language"--> c11
end