Important note: QLever's capabilities have improved significantly since the publication of our SIGSPTIAL'21 paper. In particular, exact geometry queries are now feasible even for the complete OSM data. Since in most cases, exact geometry queries are preferable to the approximate bounding box queries from the paper, the latter are currently not supported by QLever (but will be again in the near future for those who need them).
For each subsection, we give the four concrete queries for the four backends in this order (which is also the order of the columns in Table 3)
QLever https://qlever.cs.uni-freiburg.de/osm-planet
Overpass API http://osm2rdf.cs.uni-freiburg.de:8081
PostGIS http://osm2rdf.cs.uni-freiburg.de:8083/pgadmin4/browser (requires login)
Sophox https://sophox.org
For Q4 (OSM Germany):
QLever https://qlever.cs.uni-freiburg.de/osm-germany
Overpass API http://osm2rdf.cs.uni-freiburg.de:8082
PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
SELECT ?osm_id ?geometry WHERE {
?osm_id osmkey:building "university" .
?osm_id geo:hasGeometry ?geometry .
}
Direct link to query with QLever
way[building=university];
out geom;
Direct link to query with Overpass
SELECT osm_id, way
FROM planet_osm_polygon
WHERE way building = 'university';
Link to PostGIS instance (copy&paste query)
PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
SELECT ?osm_id ?centroid WHERE {
?osm_id osmt:building "university" .
?osm_id osmm:loc ?centroid .
}
Direct link to query with Sophox
PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX osm: <https://www.openstreetmap.org/>
SELECT ?osm_id ?geometry WHERE {
?osm_id osmkey:building "university" .
?osm_id geo:hasGeometry ?geometry .
?osm_id osm:envelope ?envelope .
FILTER contained(?envelope, "LINESTRING(5.866315 47.270111, 15.041809 55.099161)")
}
way[building=university](47.270111, 5.866315, 55.099161 ,15.041809);
out geom;
Direct link to query with Overpass
SELECT osm_id, way
FROM planet_osm_polygon
WHERE way && ST_Transform(ST_MakeEnvelope(5.866315, 47.270111, 15.041809, 55.099161, 4326), 3857)
AND building = 'university';
Link to PostGIS instance (copy&paste query)
PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
SELECT ?osm_id ?centroid WHERE {
?osm_id osmt:building "university" .
SERVICE wikibase:box {
?osm_id osmm:loc ?centroid .
bd:serviceParam wikibase:cornerSouthWest "Point(5.866315 47.270111)"^^geo:wktLiteral .
bd:serviceParam wikibase:cornerNorthEast "Point(15.041809 55.099161)"^^geo:wktLiteral .
}
}
Direct link to query with Sophox
PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX osm: <https://www.openstreetmap.org/>
SELECT ?osm_id ?geometry WHERE {
?osm_id osmkey:building "university" .
?osm_id geo:hasGeometry ?geometry .
?osm_id osm:envelope ?envelope .
FILTER contained(?envelope, "LINESTRING(7.662006 47.903578, 7.930844 48.071058)")
}
way[building=university](47.903578, 7.662006, 48.071058, 7.930844);
out geom;
Direct link to query with Overpass
SELECT osm_id, way
FROM planet_osm_polygon
WHERE way && ST_Transform(ST_MakeEnvelope(7.662006, 47.903578, 7.930844, 48.071058, 4326), 3857)
AND building = 'university';
Link to PostGIS instance (copy&paste query)
PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
SELECT ?osm_id ?centroid WHERE {
?osm_id osmt:building "university" .
SERVICE wikibase:box {
?osm_id osmm:loc ?centroid .
bd:serviceParam wikibase:cornerSouthWest "Point(7.662006 47.903578)"^^geo:wktLiteral .
bd:serviceParam wikibase:cornerNorthEast "Point(7.930844 48.071058)"^^geo:wktLiteral .
}
}
Direct link to query with Sophox
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX ogc: <http://www.opengis.net/rdf#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
SELECT ?osm_id ?geometry WHERE {
osmrel:62768 ogc:contains ?osm_id .
?osm_id osmkey:building "university" .
?osm_id geo:hasGeometry ?geometry .
}
Direct link to query with QLever
relation(62768);
map_to_area;
way[building=university](area);
out geom;
Direct link to query with Overpass
SELECT osm_id, way
FROM planet_osm_polygon
WHERE way && ( SELECT way FROM planet_osm_polygon WHERE osm_id = -62768 )
AND building = 'university';
Link to PostGIS instance (copy&paste query)
[no Sophox support for “contained in geometry” queries]