query-25b21205928ecaab662edf83b29556c1
: The geospatial search gives an error message if the globe parameter isn't a constant. So it will be necessary to first make one query to get the globe, and then make another query with the found globe inserted as a constant. If a bound variable was possible you could use this query: Bouzinac@ 08:57, 4 November 2020 (UTC) Jura. --- Wikidata:Property_proposal/planetary_coordinatesBTW We are trying to improve the situation for non-Earth coordinates currently mixed into P625, see "geoGlobe" should be "globe", but I'm not sure if that works well with wikibase:radius though.Here is an expanded version of the query:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?loc0 ?loc1 ?place1 ?place1Label ?distWBaround ?distGEOF
WHERE
{
wd:Q867556 wdt:P625 ?loc0 .
SERVICE wikibase:around {
?place1 wdt:P625 ?loc1 .
bd:serviceParam wikibase:center ?loc0 .
bd:serviceParam wikibase:globe wd:Q405 .
bd:serviceParam wikibase:radius 200 . # which unit ?
bd:serviceParam wikibase:distance ?distWBaround . # which unit ?
}
BIND(geof:distance(?loc1, ?loc0) as ?distGEOF) # which unit ?
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?distGEOF"):::projected
v4("?distWBaround"):::projected
v1("?loc0"):::projected
v3("?loc1"):::projected
v2("?place1"):::projected
c9(["200^^xsd:integer"]):::literal
c4(["bd:serviceParam"]):::iri
c7(["wd:Q405"]):::iri
c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c1(["wd:Q867556"]):::iri
c1 --"wdt:P625"--> v1
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v2 --"wdt:P625"--> v3
c4 --"wikibase:center"--> v1
c4 --"wikibase:globe"--> c7
c4 --"wikibase:radius"--> c9
c4 --"wikibase:distance"--> v4
end
bind0[/"http://www.opengis.net/def/function/geosparql/distance(?loc1,?loc0)"/]
v3 --o bind0
v1 --o bind0
bind0 --as--o v5
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c4 --"wikibase:language"--> c13
end