Skip to content

Instantly share code, notes, and snippets.

@lucaswerkmeister
Created June 25, 2017 09:08
Show Gist options
  • Save lucaswerkmeister/4262447917150461e8e3bbd77df34a52 to your computer and use it in GitHub Desktop.
Save lucaswerkmeister/4262447917150461e8e3bbd77df34a52 to your computer and use it in GitHub Desktop.
“railway things” in Berlin, as classified by LinkedGeoData.org
#defaultView:Map
PREFIX lgdo: <http://linkedgeodata.org/ontology/>
PREFIX geom: <http://geovocab.org/geometry#>
PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX bif: <bif:>
SELECT ?subway ?geometry (SAMPLE(?label) AS ?label) ?layer WHERE {
SERVICE <http://linkedgeodata.org/sparql> {
?railwayThing a lgdo:RailwayThing;
geom:geometry [ ogc:asWKT ?geometry_ ].
FILTER(bif:st_intersects(?geometry_, bif:st_point(13.383333, 52.516667), 0.1))
OPTIONAL { ?railwayThing rdfs:label ?label. }
OPTIONAL { ?railwayThing a lgdo:Subway. BIND("subway" AS ?subway) }
OPTIONAL { ?railwayThing a lgdo:Rail. BIND("rail" AS ?rail) }
OPTIONAL { ?railwayThing a lgdo:LightRail. BIND("light rail" AS ?lightrail) }
}
BIND(STRDT(STR(?geometry_), ogc:wktLiteral) as ?geometry)
BIND(COALESCE(?subway, ?lightrail, ?rail, "other") AS ?layer)
}
GROUP BY ?subway ?geometry ?layer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment