## Snap a coordinate to the nearest road `routing.nearest(**kwargs) -> NearestResult` **get** `/api/v1/nearest` Snap a coordinate to the nearest road ### Parameters - `lat: Float` Latitude - `lng: Float` Longitude - `radius: Integer` Search radius in meters (default 500, max 5000) ### Returns - `class NearestResult` GeoJSON Point Feature snapped to the nearest road segment - `geometry: GeoJsonGeometry` - `coordinates: Array[Float] | Array[Array[Float]] | Array[Array[Array[Float]]] | Array[Array[Array[Array[Float]]]]` GeoJSON coordinates array (nesting depth varies by geometry type) - `Array[Float]` - `Array[Array[Float]]` - `Array[Array[Array[Float]]]` - `Array[Array[Array[Array[Float]]]]` - `type: :Point | :LineString | :Polygon | 3 more` - `:Point` - `:LineString` - `:Polygon` - `:MultiPoint` - `:MultiLineString` - `:MultiPolygon` - `properties: { distance_m, edge_id}` - `distance_m: Float` Distance to nearest road in meters - `edge_id: Integer` Road edge ID - `type: :Feature` - `:Feature` ### Example ```ruby require "plaza" plaza = Plaza::Client.new( api_key: "My API Key", environment: "local" # defaults to "production" ) nearest_result = plaza.routing.nearest(lat: 0, lng: 0) puts(nearest_result) ``` #### Response ```json { "geometry": { "coordinates": [ 0 ], "type": "Point" }, "properties": { "distance_m": 0, "edge_id": 0 }, "type": "Feature" } ```