query-334e905f020465988b02ed2aef2d2dd3
New feature for the Query Service: check the location of the browserHello all, in a query to ask for the location. When running the query, the browser will ask for current location. [AUTO_COORDINATES]The Wikidata Query Service now offers the possibility to build queries including your current location. You can use the code For example, here's a query showing the items that are located around you, with markers colored depending on P31:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT ?place ?placeLabel ?image ?coordinate_location ?dist ?instance_of ?instance_ofLabel ?layer WHERE {
SERVICE wikibase:around {
?place wdt:P625 ?location.
bd:serviceParam wikibase:center "[AUTO_COORDINATES]".
bd:serviceParam wikibase:radius "1".
bd:serviceParam wikibase:distance ?dist.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
OPTIONAL { ?place wdt:P18 ?image. }
OPTIONAL { ?place wdt:P625 ?coordinate_location. }
OPTIONAL { ?place wdt:P31 ?layer. }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?coordinate_location"):::projected
v3("?dist"):::projected
v4("?image"):::projected
v6("?layer"):::projected
v2("?location")
v1("?place"):::projected
c7(["1"]):::literal
c3(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c5(["#91;AUTO_COORDINATES#93;"]):::literal
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v1 --"wdt:P625"--> v2
c3 --"wikibase:center"--> c5
c3 --"wikibase:radius"--> c7
c3 --"wikibase:distance"--> v3
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c3 --"wikibase:language"--> c11
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P18".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P625".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P31".-> v6
end