Skip to content

Ninja Mobility API: DLT operator usage

cdercoli edited this page Sep 13, 2024 · 1 revision

The time series API offers a feature that exploits the 'dlt' (distance less than) operator, whereby users can filter stations by passing a GPS point and a distance in meters around it, limiting their search to a circular area. Previously, users had to resort to search by bounding box (bbc,bbi), which is often more cumbersome and un-intuitive to use, whereas now it is straight-forward. Below is an example.

For example, this line will return only parking stations in a 3km radius from the center of Meran: https://mobility.api.opendatahub.com/v2/flat,node/ParkingStation?where=scoordinate.dlt.(3000,11.158682,46.668853)

From the Swagger https://swagger.opendatahub.com/?url=https://mobility.api.opendatahub.com/v2/apispec#/, by expanding the field under "Station / time series" called "GET/v2/{representation}/{stationTypes}/{dataTypes}/{from}/{to}", one would obtain the following result:

image

Scrolling then to the "where" filter, it is possible to choose the new operator "dlt", which represents the within distance (in meters) from a specific point:

image

In order to use it, it is enough to add, in the "where" box, the point from which the distance needs to be calculated, expressed as follows: coordinate.dlt.(5000,11.2,46.7,4326). Note that the ordering inside the coordinate list is distance (in meters), point-x, point-y and SRID (optional, defaults to 4326).

This will return all stations within a 5000 meters distance from the point indicated by the coordinates: https://mobility.api.opendatahub.com/v2/flat,node/ParkingStation?where=scoordinate.dlt.(5000,11.2,46.7)

Clone this wiki locally