Exclude a polygon from routing

Hello,
am I right that there is no feature where you can create a polygon or bounding box and the routing api will calculate a route where the route is calculated around the polygon or have I overlooked that feature?

Thanks

Hi @NicolasT,

you can do this by using the options parameter and setting the avoid_polygons,
see e.g. Replicate and edit MultiPolygon
or https://github.com/GIScience/openrouteservice-docs#examples
The polygon needs to be in geojson format.

best regards,
Amandus

2 Likes

@amandus change this parameter avoid_polygons require a rebuild of graph?

Not sure i get the question?

avoid_polygons is a request parameter, where you pass a GeoJSON.
Do you mean the parameters regarding avoid_polygons in the default routing parameters of the backend?

I don’t think you would need a rebuild graphs as these are the maximum values that the polygons passed with the current request get checked against. Nothing to do with the graphs.
(but not 100% sure)

Best regards

hi @amandus

I need to have avoid_polygons for the cost matrix calculation

so I was wondering if the matrix api uses the default params inserted in the profiles.

or if matrix accepts this parameter at runtime, but I haven’t seen an options parameter in the matrix api documentation
https://openrouteservice.org/dev/#/api-docs/v2/matrix/{profile}/post

Yes, matrix does not support any options currently.

There are advances regarding avoid polygons with matrix, but they are on hold.