Adding road closure

Add road closure and generate a shortest route from location A to B considering the that road closure. I means avoiding that road closure.

Hey,

your message doesn’t really pose a question, so it’s a bit hard to understand your problem.

I assume you want to know how you can add a road closure and subsequently use that for routing.

If the road closure is actually present in the real world, you should just map it on OpenStreetMap. It will then find its way into our public API, but this will take some time.

For a short-term solution, consider using the avoid area features. You can use a small area to be avoided that spans part of the road in question, leading to openrouteservice not considering it.

Best regards

Do you have a guide on how I should code it.
Allow me to repeat my requirement. I need to enter a road closure then generate a shortest route avoiding that road closure I just set. Yes the closure is just my own.

I highly appreciate your response.

Hey,

are you using our API directly, via one of our SDKs or are you using the client at maps.openrouteservice.org?

Are we talking about a single road that is closed, or a set of roads?

Best regards

Hello jschnell,

yes I am using your API with a token.

It could be one or many road closure that is user defined (I mean setting my own). That never affect the original data of the API.

Best regards,
Christian

Hey,

the API option you’re looking for is under optionsavoid_polygons .
This parameter accepts a GeoJSON polygon or multipolygon.

You can create geojson polygons on sites like geojson.io or use a tool like qgis.

To avoid a road, the corresponding polygon has to overlap said road - think of drawing a barrier extending to both sides of the road.

Best regards

1 Like