## Snap a coordinate to the nearest road `routing().nearest(RoutingNearestParamsparams, RequestOptionsrequestOptions = RequestOptions.none()) : NearestResult` **get** `/api/v1/nearest` Snap a coordinate to the nearest road ### Parameters - `params: RoutingNearestParams` - `lat: Double` Latitude - `lng: Double` Longitude - `radius: Optional` Search radius in meters (default 500, max 5000) ### Returns - `class NearestResult:` GeoJSON Point Feature snapped to the nearest road segment - `geometry: GeoJsonGeometry` - `coordinates: Coordinates` GeoJSON coordinates array (nesting depth varies by geometry type) - `List` - `List>` - `List>>` - `List>>>` - `type: Type` - `POINT("Point")` - `LINE_STRING("LineString")` - `POLYGON("Polygon")` - `MULTI_POINT("MultiPoint")` - `MULTI_LINE_STRING("MultiLineString")` - `MULTI_POLYGON("MultiPolygon")` - `properties: Properties` - `distanceM: Optional` Distance to nearest road in meters - `edgeId: Optional` Road edge ID - `type: Type` - `FEATURE("Feature")` ### Example ```kotlin package com.plazafyi.example import com.plazafyi.client.PlazaClient import com.plazafyi.client.okhttp.PlazaOkHttpClient import com.plazafyi.models.routing.NearestResult import com.plazafyi.models.routing.RoutingNearestParams fun main() { val client: PlazaClient = PlazaOkHttpClient.fromEnv() val params: RoutingNearestParams = RoutingNearestParams.builder() .lat(0.0) .lng(0.0) .build() val nearestResult: NearestResult = client.routing().nearest(params) } ``` #### Response ```json { "geometry": { "coordinates": [ 0 ], "type": "Point" }, "properties": { "distance_m": 0, "edge_id": 0 }, "type": "Feature" } ```