query-1646ce7ce9b676bc2a1ed7c79ce337c5
Visualize places within 3 miles of the Welcome to Fabulous Las Vegas sign (Color Coded by P31)Generate map of places within 3 miles of the Welcome to Fabulous Las Vegas sign (Q175665)
Use at
- https://query.wikidata.org/sparql
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
#defaultView:Map
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item ?itemLabel ?location ?layerLabel
WHERE
{
wd:Q175665 wdt:P625 ?loc .
SERVICE wikibase:around {
?item wdt:P625 ?location .
bd:serviceParam wikibase:center ?loc .
bd:serviceParam wikibase:radius "4.82803" . # Miles converted to kilometers here
}
OPTIONAL { ?item wdt:P31 ?instance }
BIND(?instance AS ?layer).
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
BIND(geof:distance(?loc, ?location) as ?dist)
} ORDER BY ASC(?layerLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?dist")
v5("?instance")
v3("?item"):::projected
v6("?layer")
v1("?layerLabel"):::projected
v2("?loc")
v4("?location"):::projected
c4(["bd:serviceParam"]):::iri
c7(["4.82803"]):::literal
c11(["en"]):::literal
c1(["wd:Q175665"]):::iri
c1 --"wdt:P625"--> v2
subgraph s1["http://wikiba.se/ontology#around"]
style s1 stroke-width:4px;
v3 --"wdt:P625"--> v4
c4 --"wikibase:center"--> v2
c4 --"wikibase:radius"--> c7
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P31".-> v5
end
bind0[/"?instance"/]
v5 --o bind0
bind0 --as--o v6
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c4 --"wikibase:language"--> c11
end
bind1[/"http://www.opengis.net/def/function/geosparql/distance(?loc,?location)"/]
v2 --o bind1
v4 --o bind1
bind1 --as--o v7