Open nospi opened 1 year ago
Oops, yeah that’s the „kids diseases“:) We’d be happy with a PR, as you wish. FWIW, avoid polygons does not take location objects but a plain array of coordinates (essentially a open/closed ring), as that’s not supposed to snap to road segments but describe polygons.
I've made the changes on a local branch but I'm afraid I've not submitted a PR before. Do I need to fork the repo in order to push to a branch for comparison and PR creation?
EDIT: all done, submitted a PR from a fork.
The avoidLocations and avoidPolygons DirectionsOptions are not formatted as Valhalla expects them to be.
When running with dryRun: true in order to see what's going on:
I dug into the built code; the issue is here:
The Valhalla API expects the avoid locations parameters to be formatted identically to the directions location parameters (object with lat/lon properties). https://github.com/valhalla/valhalla-docs/blob/master/turn-by-turn/api-reference.md
I am passing an array, so I've edited only the top portion of this segment of code:
Or perhaps something more general:
That fixed the issue for me (for avoidLocations only; would also need the same in avoidPolygons). Dry run result:
And the final success from the valhalla public server:
I wanted to write a PR but I'm not sure how this would be handled from the typescript/interfaces perspective; but please let me me know if you'd like me to have a go at it.
Cheers!
EDIT: just saw the _buildLocations function.