The Direction API is awesome. The part that is most important for me is the possibility to Avoid specific areas.
So You can pass the latitudes/longitudes of origin and destination (and any other in between) and a list of polygons that must be avoided.
It would be nice if the Direction API could return the subset of Polygons (items of the avoid polygon list) that actually were in the route and caused the router to change it’s direction.
For now what I’m doing is:
- fetching the best route without any Avoid Area
- for each coordinate of the waypath I’m checking if it is inside any Avoid Area Polygon. (Slow)
2.1. if there is no coordinate inside any polygon, then the router is finished
2.2. if there is any coordinate inside any polygon, then I send again to the router with all the Avoided Areas.
That way I can save the avoided areas that caused the direction change.