Snap a coordinate to the nearest road
routing.nearest_post(**kwargs) -> NearestResult { geometry, properties, type }
POST/api/v1/nearest
Snap a coordinate to the nearest road
Parameters
Snap a coordinate to the nearest road
require "plaza"
plaza = Plaza::Client.new(
api_key: "My API Key",
environment: "local" # defaults to "production"
)
nearest_result = plaza.routing.nearest_post(lat: 0, lng: 0)
puts(nearest_result){
"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"
}Returns Examples
{
"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"
}