query-b92283d6756fe9c2169b61a4ca31e2ab
Boundary polygons for London boroughsI would like to get a set of boundary polygons for the London boroughs, in order to help determine which borough a coordinate is in. identifier. (P836)GSS code (2011) I can get close to what I want with the following federated query, which gets the data from the UK Ordnance Survey, matching on the
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?gss ?os_toid ?bounds WHERE {
?item wdt:P31 wd:Q211690 .
OPTIONAL {
?item wdt:P836 ?gss .
SERVICE <http://data.ordnancesurvey.co.uk/datasets/os-linked-data/apis/sparql> {
?os_toid <http://data.ordnancesurvey.co.uk/ontology/admingeo/gssCode> ?gss .
?os_toid <http://data.ordnancesurvey.co.uk/ontology/geometry/extent> ?extent .
?extent <http://data.ordnancesurvey.co.uk/ontology/geometry/asGML> ?bounds .
}
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} ORDER BY ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?bounds"):::projected
v5("?extent")
v3("?gss"):::projected
v2("?item"):::projected
v1("?itemLabel"):::projected
v4("?os_toid"):::projected
c9(["bd:serviceParam"]):::iri
c2(["wd:Q211690"]):::iri
c11(["en"]):::literal
v2 --"wdt:P31"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P836".-> v3
subgraph s1["http://data.ordnancesurvey.co.uk/datasets/os-linked-data/apis/sparql"]
style s1 stroke-width:4px;
v4 --http://data.ordnancesurvey.co.uk/ontology/admingeo/gssCode--> v3
v4 --http://data.ordnancesurvey.co.uk/ontology/geometry/extent--> v5
v5 --http://data.ordnancesurvey.co.uk/ontology/geometry/asGML--> v6
end
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c9 --"wikibase:language"--> c11
end