query-82384976be77d2d0284022b9af3d10bf

rq turtle/ttl

List all elements close to a GPS point

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT ?place ?placeLabel ?location ?instanceLabel ?dist WHERE {
  SERVICE wikibase:around {
      ?place wdt:P625 ?location .
      bd:serviceParam wikibase:center "Point(24.71304 10.2059)"^^geo:wktLiteral .
      bd:serviceParam wikibase:radius 30 . # in kilometers
  }
  OPTIONAL { 
    ?place wdt:P31 ?instance .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
  BIND(geof:distance(?loc, ?location) AS ?dist) .
} ORDER BY ASC(?dist)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?dist"):::projected v4("?instance") v3("?location"):::projected v2("?place"):::projected c3(["bd:serviceParam"]):::iri c11(["en"]):::literal c7(["30^^xsd:integer"]):::literal c5([sPoint(24.71304 10.2059)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal subgraph s1["http://wikiba.se/ontology#around"] style s1 stroke-width:4px; v2 --"wdt:P625"--> v3 c3 --"wikibase:center"--> c5 c3 --"wikibase:radius"--> c7 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P31".-> v4 end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c3 --"wikibase:language"--> c11 end bind0[/"http://www.opengis.net/def/function/geosparql/distance(?loc,?location)"/] null --o bind0 v3 --o bind0 bind0 --as--o v5