This will search for road segments within 5 meter radius of the input location and choose the best path from/to whichever segment gives the cheapest cost. It should be preferable in most scenarios compared to simply snapping to the closest segment.
I'll do the same PR for our web app at https://github.com/gis-ops/valhalla-app.
data: {
json: JSON.stringify({
locations: points.map(function (p) {
data: {
json: JSON.stringify({
locations: points.map(function (p) {
- return { lat: p.lat, lon: p.lng };
+ return { lat: p.lat, lon: p.lng, radius: 5 };
}),
costing: costing,
directions_options: {
}),
costing: costing,
directions_options: {