Skip to content
GuidesPlaygroundDashboard

Snap a coordinate to the nearest road

$ plaza routing nearest
GET/api/v1/nearest

Snap a coordinate to the nearest road

ParametersExpand Collapse
--lat: number

Latitude

--lng: number

Longitude

--radius: optional number

Search radius in meters (default 500, max 5000)

ReturnsExpand Collapse
nearest_result: object { geometry, properties, type }

GeoJSON Point Feature snapped to the nearest road segment

geometry: object { 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)

union_member_0: array of number
union_member_1: array of array of number
union_member_2: array of array of array of number
union_member_3: array of array of array of array of number
type: "Point" or "LineString" or "Polygon" or 3 more
"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"
"Feature"

Snap a coordinate to the nearest road

plaza routing nearest \
  --api-key 'My API Key' \
  --lat 0 \
  --lng 0
{
  "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"
}