## Snap a coordinate to the nearest road `NearestResult Routing.NearestPost(RoutingNearestPostParamsparameters, CancellationTokencancellationToken = default)` **post** `/api/v1/nearest` Snap a coordinate to the nearest road ### Parameters - `RoutingNearestPostParams parameters` - `required Double lat` Latitude - `required Double lng` Longitude - `string outputFields` Comma-separated property fields to include - `string outputInclude` Extra computed fields: bbox, distance, center - `Long outputPrecision` Coordinate decimal precision (1-15, default 7) - `Long radius` Search radius in meters (default 500, max 5000) ### Returns - `class NearestResult:` GeoJSON Point Feature representing the nearest point on the road network to the input coordinate. Used for snapping GPS coordinates to roads. - `required GeoJsonGeometry Geometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `required Coordinates Coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `IReadOnlyList` - `IReadOnlyList>` - `IReadOnlyList>>` - `IReadOnlyList>>>` - `required Type Type` Geometry type - `"Point"Point` - `"LineString"LineString` - `"Polygon"Polygon` - `"MultiPoint"MultiPoint` - `"MultiLineString"MultiLineString` - `"MultiPolygon"MultiPolygon` - `required Properties Properties` Snap result metadata - `Double DistanceM` Distance from the input coordinate to the snapped point in meters - `Long EdgeID` ID of the road network edge that was snapped to - `Double EdgeLengthM` Length of the matched road edge in meters - `string? Highway` OSM highway tag value (e.g. `residential`, `primary`, `motorway`) - `Long OsmWayID` OSM way ID of the matched road segment - `string? Surface` OSM surface tag value (e.g. `asphalt`, `gravel`, `paved`) - `required Type Type` - `"Feature"Feature` ### Example ```csharp RoutingNearestPostParams parameters = new() { Lat = 0, Lng = 0, }; var nearestResult = await client.Routing.NearestPost(parameters); Console.WriteLine(nearestResult); ``` #### Response ```json { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "distance_m": 12.4, "edge_id": 0, "edge_length_m": 0, "highway": "highway", "osm_way_id": 0, "surface": "surface" }, "type": "Feature" } ```