Hi, On 26.08.20 03:29, Alex Valencia wrote: > So I was thinking if there is a proper way to achieve this goal. We > are considering separating the matrix calculation over the map in a > separate function and feeding it with a decorated version of the > original map where we can remove these regions on the fly prior to the > calculation. But I'm also not sure if this is a realistic way either.
The only routing package I know that does polygonal avoid areas out of the box is OpenRouteService which internally is powered by a modified version of GraphHopper. However, only the simple route request supports avoid areas, not the matrix request, and it's only available if you use basic A*. Using avoid areas with Contraction Hierarchies is impossible unless the avoid areas are baked into the graph (i.e. known at graph building time). If your avoid areas *are* known at graph building time then actually removing edges from the OSM data (or doing so while reading it into OSRM) is certainly option that gives you the fastest routing speed. If you want to use OSRM, and if you want to use dynamic avoid areas, then this *might* be possible with a MLD routing graph which has the option of changing the weighting of certain edges without re-generating the graph; this was implemented to allow for live traffic (search for "osrm traffic" and you'll find some stuff about it, using osrm-customize). However this still requires you to identify the edges you wish to cut off (by giving them a zero rating), and it is only possible globally and not on a per-request basis (unlike OpenRouteService which lets you set avoid areas per-request). If you have a number of pre-defined avoid areas and want to determine dynamically which of these should be avoided then it might be possible to abuse a feature that was built to avoid certain road classes (i.e. avoid motorways, avoid ferries); potentially you could use that to define a specific road class for all roads in your avoid area A, a different class for avoid area B etc., and then make a routing request that "avoids class A". This feature is documented here https://github.com/Project-OSRM/osrm-backend/issues/4006 Bye Frederik -- Frederik Ramm ## eMail frede...@remote.org ## N49°00'09" E008°23'33" _______________________________________________ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk