Nearest Service

Snaps a coordinate to the street network and returns the nearest n matches. Where coordinates only supports a single {longitude},{latitude} entry.

GET
/nearest/{profile}/{coordinates}

Authorization

stringRequired

LocationIQ Access Token

Path Parameters

stringRequired

Mode of transportation. driving and walking are supported.

Allowed:drivingwalking
stringRequired

String of format {longitude},{latitude};{longitude},{latitude}[;{longitude},{latitude} ...] or polyline({polyline}) or polyline6({polyline6}). You can send up to a maximum of 25 coordinate pairs per request (except Nearest API where coordinates only supports a single {longitude},{latitude} entry)

Query Parameters

string

Limits the search to segments with given bearing in degrees towards true north in clockwise direction. List of positive integer pairs separated by semi-colon and bearings array should be equal to length of coordinate array. Accepted Value :- {bearing};{bearing}[;{bearing} ...] Each {bearing} follows the following format: {value},{range} integer 0 .. 360,integer 0 .. 180

string

Limits the search to given radius in meters Radiuses array length should be same as coordinates array, each value separated by semi-colon. Accepted Value - {radius};{radius}[;{radius} ...] Each {radius} has following format: double >= 0 or unlimited (default)

string

Hint from previous request to derive position in street network. Accepted value: {hint};{hint}[;{hint} ...]

integer

Number of nearest segments that should be returned. Accepted value: integer >= 1 (default 1)

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/nearest/driving/string?bearings=10%2C20%3B40%2C30%3B30%2C9&radiuses=500%3B200%3B300&number=3"
{  "waypoints": {    "nodes": [      2966517546,      0    ],    "distance": 159.132824,    "location": [      -0.161547,      51.522462    ],    "name": "Balcombe Street"  },  "code": "ok"}