## Snap a coordinate to the nearest road `routing.nearest(RoutingNearestParams**kwargs) -> NearestResult` **get** `/api/v1/nearest` Snap a coordinate to the nearest road ### Parameters - `lat: float` Latitude - `lng: float` Longitude - `radius: Optional[int]` Search radius in meters (default 500, max 5000) ### Returns - `class NearestResult: …` GeoJSON Point Feature snapped to the nearest road segment - `geometry: GeoJsonGeometry` - `coordinates: Union[List[float], List[List[float]], List[List[List[float]]], List[List[List[List[float]]]]]` GeoJSON coordinates array (nesting depth varies by geometry type) - `List[float]` - `List[List[float]]` - `List[List[List[float]]]` - `List[List[List[List[float]]]]` - `type: Literal["Point", "LineString", "Polygon", 3 more]` - `"Point"` - `"LineString"` - `"Polygon"` - `"MultiPoint"` - `"MultiLineString"` - `"MultiPolygon"` - `properties: Properties` - `distance_m: Optional[float]` Distance to nearest road in meters - `edge_id: Optional[int]` Road edge ID - `type: Literal["Feature"]` - `"Feature"` ### Example ```python import os from plaza import Plaza client = Plaza( api_key=os.environ.get("PLAZA_API_KEY"), # This is the default and can be omitted ) nearest_result = client.routing.nearest( lat=0, lng=0, ) print(nearest_result.geometry) ``` #### Response ```json { "geometry": { "coordinates": [ 0 ], "type": "Point" }, "properties": { "distance_m": 0, "edge_id": 0 }, "type": "Feature" } ```