Snap a coordinate to the nearest road
client.routing.nearest(RoutingNearestParams { lat, lng, radius } query, RequestOptionsoptions?): NearestResult { geometry, properties, type }
GET/api/v1/nearest
Snap a coordinate to the nearest road
import Plaza from '@plazafyi/sdk';
const client = new Plaza({
apiKey: process.env['PLAZA_API_KEY'], // This is the default and can be omitted
});
const nearestResult = await client.routing.nearest({ lat: 0, lng: 0 });
console.log(nearestResult.geometry);{
"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"
}