query-d1e3893540e51808c9a86f1234ae2a26

rq turtle/ttl

Items with coordinates within an OSM relation 13:28, 24 November 2020 (UTC)) talk (Afnecors="1590405"). --(P402)OpenStreetMap relation ID (<= this item have (Q3685557)Primiero ) inside (Q16970)church building =(P31)instance of Is there a way to get all items that have coordinates inside a OSM relation? For example: get all churches (If you can get the extreme points for the relation, you could try a bounding box query.14:13, 24 November 2020 (UTC) Jura. --- mw:Wikidata_Query_Service/User_Manual#Search_within_boxOk, I do something like that:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Churches in Primiero
#defaultView:Map
SELECT * WHERE {
SERVICE wikibase:box {
    ?place wdt:P625 ?location .
    bd:serviceParam wikibase:cornerWest "Point(11.5947 46.0937)"^^geo:wktLiteral .
    bd:serviceParam wikibase:cornerEast "Point(11.9662 46.3602)"^^geo:wktLiteral .
  }
  FILTER EXISTS { ?place wdt:P31/wdt:P279* wd:Q16970 }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?location"):::projected v1("?place"):::projected a1((" ")) c8([sPoint(11.5947 46.0937)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal c10([sPoint(11.9662 46.3602)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal c6(["bd:serviceParam"]):::iri c3(["wd:Q16970"]):::iri f0[[" "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P31"--> e0a1 e0a1 --"wdt:P279"--> e0c3 e0v1("?place"):::projected e0a1((" ")):::projected e0c3(["wd:Q16970"]):::iri end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> a1 f0 --> c2 f0 --> c3 v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 subgraph s1["http://wikiba.se/ontology#box"] style s1 stroke-width:4px; v1 --"wdt:P625"--> v2 c6 --"wikibase:cornerWest"--> c8 c6 --"wikibase:cornerEast"--> c10 end