Snap to Roads API

Snap GPS coordinates to the nearest road. Useful for cleaning noisy GPS traces from vehicles and creating smooth route paths.

Try in Playground →

Endpoint

POST/v4/snap.json

Authentication

Include your token in the request header:

X-Authorization-Token: your_token

Parameters

NameTypeDescription
coordinatesarrayArray of [longitude, latitude] pairs

Code Examples

curl -X POST "https://apihub.latlong.ai/v4/snap.json" \
  -H "X-Authorization-Token: YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "coordinates": [
    [
      77.59,
      12.97
    ],
    [
      77.6,
      12.98
    ]
  ]
}'

Example Response

JSON
{
  "status": "success",
  "code": 1001,
  "data": {
    "snapped_coordinates": [
      [77.5902, 12.9701],
      [77.6001, 12.9798],
      [77.6103, 12.9902]
    ]
  }
}