Spatial Search for Features

Possibilities to Provide a Geometry for Spatial Searches

A spatial search requires a Geometry as an input. One common use case: find all Features which are around 1000 meters from a given Position. Another one could be: find all Features which are 100 meters beside a road.

You can accomplish this kind of spatial search by providing a Point or Linestring Geometry and a radius in meters, which gets applied to thicken the input Geometry.

Another common use case is finding all Features belonging to a country. For this, you only need to provide the Polygon Geometry of the country. The request allows the following GeoJSON Geometry types as input: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon.

Submitting Geometry via POST Request

The easiest way for providing a search Geometry is submitting it via a POST-Request.

Another way to provide a search Geometry is to read it from an existing Feature, which is stored in an Interactive Map Layer. This is recommended if your search Geometry is very complex, or if you want to store frequently used Geometries for spatial searches.

Using spatial GET-Requests

This request asks for features which are inside the specified radius. The origin radius point is calculated based either on latitude & longitude or by specifying a feature's geometry.

GET /<Base path for the interactive API from the API Lookup Service>/layers/<Layer ID>/spatial?lon=<Longitude>&lat=<Latitude>}&radius=<raduisInMeters>

Spatial search referencing a Feature from an interactive map layer:

GET /<Base path for the interactive API from the API Lookup Service>/layers/<Layer ID>/spatial?refLayerId=<Referenced Layer ID>&refFeatureId=<rReferennced Feature ID>

Note

For authorization in a GET request you can also use an API Key as a query parameter instead of a bearer token in an authorization header.

Response (Example)

{
    "type": "FeatureCollection",
    "features":
    [
        {
            "type": "Feature",
            "id": "BfiimUxHjj",
            "geometry":
            {
                "type": "Point",
                "coordinates":
                [
                    7.01,
                    50.03
                ]
            },
            "properties":
            {
                "name": "Anfield",
                "@ns:com:here:xyz":
                {
                    "createdAt": 1517504700726,
                    "updatedAt": 1517504700726
                },
                "amenity": "Football Stadium",
                "capacity": 54074,
                "popupContent": "Home of Liverpool Football Club"
            }
        }
    ]
}

Using spatial POST-Requests

This request yields features inside the specified radius. The origin point is calculated based on the geometry provided as payload.

POST /<Base path for the interactive API from the API Lookup Service>/layers/<Layer ID>/spatial

with the following body

{
    "type": "MultiPolygon",
    "coordinates": [
        [
            [
                [
                    7,
                    50
                ],
                [
                    7.1,
                    50
                ],
                [
                    7.1,
                    50.1
                ],
                [
                    7,
                    50.1
                ],
                [
                    7,
                    50
                ]
            ],
            [
                [
                    7.05,
                    50.05
                ],
                [
                    7.05,
                    50.09
                ],
                [
                    7.09,
                    50.09
                ],
                [
                    7.09,
                    50.05
                ],
                [
                    7.05,
                    50.05
                ]
            ]
        ]
    ]
}

Response

{
    "type": "FeatureCollection",
    "features":
    [
        {
            "type": "Feature",
            "id": "BfiimUxHjj",
            "geometry":
            {
                "type": "Point",
                "coordinates":
                [
                    7.01,
                    50.03
                ]
            },
            "properties":
            {
                "name": "Anfield",
                "@ns:com:here:xyz":
                {
                    "createdAt": 1517504700726,
                    "updatedAt": 1517504700726
                },
                "amenity": "Football Stadium",
                "capacity": 54074,
                "popupContent": "Home of Liverpool Football Club"
            }
        }
    ]
}

results matching ""

    No results matching ""