POIs in and around Berlin
SPARQL with Elasticsearch Geo Queries (Recommended)
The SPARQL API supports geospatial search: select entities that fall inside a rectangular
bounding box or within a given radius of a coordinate. Send the query as a GET
request to the SPARQL endpoint (see Authentication
for the X-API-KEY header).
GET https://proxy.opendatagermany.io/api/ts/v1/kg/sparql
Header: X-API-KEY: <your-key>
Header: Accept: application/sparql-results+json
Param: query=<url-encoded SPARQL>
Each query returns ?id, ?lat, ?lon, and the matched Domain Specification ?ds. The
UNION blocks pull one content category each — gastronomy (zmoYZEMoSAKS), events
(ywkngcBEETdh), lodging (xVTuYwJrJrfq), and POIs/attractions (pxNgHzzhpeUu). Keep only
the blocks you need.
Bounding-box variant: POIs in and around Berlin
Selects everything inside a rectangular area.
PREFIX inst: <http://www.ontotext.com/connectors/elasticsearch/instance#>
PREFIX con: <http://www.ontotext.com/connectors/elasticsearch#>
PREFIX schema: <https://schema.org/>
PREFIX ds: <https://vocab.sti2.at/ds/>
SELECT ?id ?lat ?lon ?ds WHERE {
# --- bounding-box search: edit coordinates + relation only ---
?search a inst:dzt-geo-shapes ;
con:query "{\"query\":{\"geo_shape\":{\"geometry\":{\"shape\":{\"type\":\"envelope\",\"coordinates\":[[13.088,52.675],[13.761,52.338]]},\"relation\":\"intersects\"}}}}" ;
con:entities ?geoent .
# --- end box ---
{
?geoent ds:compliesWith <https://semantify.it/ds/zmoYZEMoSAKS> ; schema:geo ?geo .
?geo schema:latitude ?lat ; schema:longitude ?lon .
BIND(?geoent AS ?id) BIND(<https://semantify.it/ds/zmoYZEMoSAKS> AS ?ds)
} UNION {
?id ds:compliesWith <https://semantify.it/ds/zmoYZEMoSAKS> ; schema:location ?geoent .
?geoent schema:geo ?geo . ?geo schema:latitude ?lat ; schema:longitude ?lon .
BIND(<https://semantify.it/ds/zmoYZEMoSAKS> AS ?ds)
} UNION {
?id ds:compliesWith <https://semantify.it/ds/ywkngcBEETdh> ; schema:location ?geoent .
?geoent schema:geo ?geo . ?geo schema:latitude ?lat ; schema:longitude ?lon .
BIND(<https://semantify.it/ds/ywkngcBEETdh> AS ?ds)
} UNION {
?geoent ds:compliesWith <https://semantify.it/ds/xVTuYwJrJrfq> ; schema:geo ?geo .
?geo schema:latitude ?lat ; schema:longitude ?lon .
BIND(?geoent AS ?id) BIND(<https://semantify.it/ds/xVTuYwJrJrfq> AS ?ds)
} UNION {
?geoent ds:compliesWith <https://semantify.it/ds/pxNgHzzhpeUu> ; schema:geo ?geo .
?geo schema:latitude ?lat ; schema:longitude ?lon .
BIND(?geoent AS ?id) BIND(<https://semantify.it/ds/pxNgHzzhpeUu> AS ?ds)
}
}
LIMIT 120 OFFSET 0Defining the box. The coordinates are two corners as [longitude, latitude]
(longitude first):
[ [minLon, maxLat], ← top-left
[maxLon, minLat] ] ← bottom-right
The example uses Berlin's bounds — lon 13.088–13.761, lat 52.338–52.675.
Radius variant: POIs within X km of a point
Selects everything within a given distance of a coordinate. Only the geo block changes; the
category logic is identical.
PREFIX inst: <http://www.ontotext.com/connectors/elasticsearch/instance#>
PREFIX con: <http://www.ontotext.com/connectors/elasticsearch#>
PREFIX schema: <https://schema.org/>
PREFIX ds: <https://vocab.sti2.at/ds/>
SELECT ?id ?lat ?lon ?ds WHERE {
# --- radius search: edit center [lon, lat] and radius only ---
?search a inst:dzt-geo-shapes ;
con:query "{\"query\":{\"geo_shape\":{\"geometry\":{\"shape\":{\"type\":\"circle\",\"radius\":\"5km\",\"coordinates\":[13.405,52.52]},\"relation\":\"intersects\"}}}}" ;
con:entities ?geoent .
# --- end radius ---
{
?geoent ds:compliesWith <https://semantify.it/ds/zmoYZEMoSAKS> ; schema:geo ?geo .
?geo schema:latitude ?lat ; schema:longitude ?lon .
BIND(?geoent AS ?id) BIND(<https://semantify.it/ds/zmoYZEMoSAKS> AS ?ds)
} UNION {
?id ds:compliesWith <https://semantify.it/ds/zmoYZEMoSAKS> ; schema:location ?geoent .
?geoent schema:geo ?geo . ?geo schema:latitude ?lat ; schema:longitude ?lon .
BIND(<https://semantify.it/ds/zmoYZEMoSAKS> AS ?ds)
} UNION {
?id ds:compliesWith <https://semantify.it/ds/ywkngcBEETdh> ; schema:location ?geoent .
?geoent schema:geo ?geo . ?geo schema:latitude ?lat ; schema:longitude ?lon .
BIND(<https://semantify.it/ds/ywkngcBEETdh> AS ?ds)
} UNION {
?geoent ds:compliesWith <https://semantify.it/ds/xVTuYwJrJrfq> ; schema:geo ?geo .
?geo schema:latitude ?lat ; schema:longitude ?lon .
BIND(?geoent AS ?id) BIND(<https://semantify.it/ds/xVTuYwJrJrfq> AS ?ds)
} UNION {
?geoent ds:compliesWith <https://semantify.it/ds/pxNgHzzhpeUu> ; schema:geo ?geo .
?geo schema:latitude ?lat ; schema:longitude ?lon .
BIND(?geoent AS ?id) BIND(<https://semantify.it/ds/pxNgHzzhpeUu> AS ?ds)
}
}
LIMIT 120 OFFSET 0Defining the circle.
coordinatesis the center as[longitude, latitude](longitude first).radiusis a distance string, e.g."500m","5km","25km".
The example returns everything within 5 km of Berlin center (lon 13.405, lat 52.52).
Spatial relations
"intersects"— any entity touching the area (use this for "in and around")."within"— only entities fully inside the area.
As a cURL request
curl -s -G 'https://proxy.opendatagermany.io/api/ts/v1/kg/sparql' \
-H 'X-API-KEY: <your-key>' \
-H 'Accept: application/sparql-results+json' \
--data-urlencode 'query=<the SPARQL above>'
Bounding box vs. radiusUse an
envelope(two corners) for a rectangular area, or acircle
(center +radius) for a distance search. Everything else in the query — the
categories and the output — stays the same.
Shape Query Approach (Legacy)
This example shows a search for instances of type odta:POI which are located within a radius of 15km around the coordinates 51.345545,12.37414, which is somewhere in Berlin.
Projection DS in use!This examples uses the concept of a projection DS. You can find an explenation what a projectionDS is and how to use it here and here.
We are searching for instances with the @type property and the sq:nearby function. The call looks as follows:
curl --location 'https://proxy.opendatagermany.io/api/ts/v2/kg/things?sortSeed=1&filterDsList=https://semantify.it/list/LRVOilZZ6&lang=de' \
--header 'Content-Type: application/ld+json' \
--header 'page-size: 50' \
--header 'page: 1' \
--header 'x-api-key: API_KEY' \
--data-raw '{
"@context": {
"ds": "https://vocab.sti2.at/ds/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"schema": "https://schema.org/",
"sh": "http://www.w3.org/ns/shacl#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"odta": "https://odta.io/voc/",
"sq": "http://www.onlim.com/shapequery/",
"@vocab": "http://www.onlim.com/shapequery/"
},
"sq:query": [
{
"@type": "odta:Place",
"schema:geo": {
"sq:nearby": {
"sq:latitude": "51.345545",
"sq:longitude": "12.37414",
"sq:distance": "15"
}
}
}
]
}'We get a response that looks something like this:
{
"metaData": {
"dsCount": {
"https://semantify.it/ds/gGDiyXWKpGpu": {
"count": "123",
"name": {
"de": "Place v2"
}
}
},
"page-size": 50,
"sortSeed": "1",
"total": 518,
"current-page": 1
},
"data": [
{
"@type": [
"https://schema.org/Thing",
"https://schema.org/Place",
"https://schema.org/TouristAttraction"
],
"https://vocab.sti2.at/ds/compliesWith": {
"@id": "https://semantify.it/ds/gGDiyXWKpGpu"
},
"@id": "http://onlim.com/entity/..."
},The @id in line 27 we use for the follow-up query:
curl --location --request GET 'https://proxy.opendatagermany.io/api/ts/v2/kg/things/3afcda58-86a3-406c-9675-f5946844a726?projectionDs=https://semantify.it/ds/Xkd5YH3-1' \
--header 'Content-Type: application/ld+json' \
--header 'x-api-key: API_KEY'Then we get the full object in the response:
[
{
"@id": "http://onlim.com/entity/3afcda58-86a3-406c-9675-f5946844a726",
"@type": [
"https://schema.org/TouristAttraction"
],
"https://schema.org/description": [
{
"@language": "de",
"@value": "Die Krochsiedlung wurde von 1929 bis 1930 erbaut. Das Gemeinschaftsprojekt der Architekten Paul Mebes, Paul Emmerich, Johannes Koppe, Adolf Muesmann und Max Fricke befindet sich im Leipziger Stadtteil Gohlis. Der jüdische Bankier Hans Kroch, der auch das Krochhaus in der Goethestraße in Auftrag gab, finanzierte das Projekt mit.\nDie Krochsiedlung wurde als erste Bauetappe einer geplanten Wohnstadt „Neu-Gohlis“ geplant. Die unweit gelegene Versöhnungskirche sollte im Mittelpunkt der neuen Siedlung liegen. Das Projekt wurde jedoch nie vollendet. Damals verkörperte das Wohngebiet neuzeitliche Wohnkultur, die der Wohnungsnot in der späten Weimarer Republik Abhilfe schaffte. In den drei- und viergeschossigen Mehrfamilienhäusern befinden sich bis heute 1018 Wohnungen mit für den Bauhaus charakteristischen Wintergärten, die in den 1990er Jahren umfassend saniert wurden.\nUm das architekturhistorische und geschichtliche Erbe der Krochsiedlung zu pflegen, wurde 1991 der „Bürgerverein Krochsiedlung e.V.“ gegründet."
},
{
"@language": "en",
"@value": "The Krochsiedlung was built between 1929 and 1930. The collaborative project by architects Paul Mebes, Paul Emmerich, Johannes Koppe, Adolf Muesmann and Max Fricke is located in Leipzig's Gohlis district. The Jewish banker Hans Kroch, who also commissioned the Krochhaus in Goethestraße, helped finance the project.\nThe Krochsiedlung was supposed to be the first construction of a planned residential town \"Neu-Gohlis\". The nearby Reconciliation Church was supposed to be the centre of the new settlement. The project, however, was never completed. At that time, the residential area embodied modern residential culture and remedied the housing shortage of the late Weimar Republic. To this day, the three and four-storey apartment buildings contain 1018 apartments with conservatories characteristic of Bauhaus, which were extensively renovated in the 1990s.\nIn 1991, the \"Bürgerverein Krochsiedlung e.V.\" was founded to preserve the architectural and historical heritage of the Krochsiedlung."
},
{
"@id": "http://onlim.com/entity/ea9c2e03-d677-4027-8e94-049e2fbf50d2"
}
],
"https://schema.org/identifier": {
"@type": "http://www.w3.org/2001/XMLSchema#anyURI",
"@value": "https://dztkg.destination.one/item/open-data-sachsen-tourismus/POI/p_100144693"
},
"https://schema.org/name": {
"@language": "de",
"@value": "Krochsiedlung"
},
"https://schema.org/sdLicense": {
"@id": "http://onlim.com/entity/6de714b3-f848-4f59-bd94-47626e87f380",
"@type": "https://schema.org/CreativeWork",
"https://schema.org/license": {
"@type": "http://www.w3.org/2001/XMLSchema#anyURI",
"@value": "http://www.leipzig.travelhttp//www.leipzig.travel"
},
"https://vocab.sti2.at/ds/compliesWith": {
"@id": "https://semantify.it/ds/vxMfgTuRcVgH"
}
},
"https://vocab.sti2.at/ds/compliesWith": {
"@id": "https://semantify.it/ds/gGDiyXWKpGpu"
}
}
]Note:
- The query above uses a projection DS. This might cause some properties not to be present in the response. Remove this parameter or change the projection DS if this is not what you expected.
- This call fetches an instance with a local name from the Onlim namespace (
http://onlim.com/entity/). Therefore, the namespace parameter can be omitted. For completeness, the call pretending NOT to use the Onlim namespace will be shown below:
curl --location --request GET 'https://proxy.opendatagermany.io/api/ts/v2/kg/things/3afcda58-86a3-406c-9675-f5946844a726?ns=http://onlim.com/entity/&projectionDs=https://semantify.it/ds/Xkd5YH3-1' \
--header 'Content-Type: application/ld+json' \
--header 'x-api-key: API_KEY'.
Updated 17 days ago
