Skip to content
GuidesPlaygroundDashboard

Snap a coordinate to the nearest road

GET/api/v1/nearest

Snap a coordinate to the nearest road

Query ParametersExpand Collapse
lat: number

Latitude

lng: number

Longitude

radius: optional number

Search radius in meters (default 500, max 5000)

ReturnsExpand Collapse
NearestResult = object { geometry, properties, type }

GeoJSON Point Feature snapped to the nearest road segment

geometry: GeoJsonGeometry { coordinates, type }
coordinates: array of number or array of array of number or array of array of array of number or array of array of array of array of number

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
array of number
array of array of number
array of array of array of number
array of array of array of array of number
type: "Point" or "LineString" or "Polygon" or 3 more
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: object { distance_m, edge_id }
distance_m: optional number

Distance to nearest road in meters

edge_id: optional number

Road edge ID

type: "Feature"

Snap a coordinate to the nearest road

curl https://plaza.fyi/api/v1/nearest \
    -H "Authorization: Bearer $PLAZA_API_KEY"
{
  "geometry": {
    "coordinates": [
      0
    ],
    "type": "Point"
  },
  "properties": {
    "distance_m": 0,
    "edge_id": 0
  },
  "type": "Feature"
}
Returns Examples
{
  "geometry": {
    "coordinates": [
      0
    ],
    "type": "Point"
  },
  "properties": {
    "distance_m": 0,
    "edge_id": 0
  },
  "type": "Feature"
}