Issues With Avoiding Polygon using geojson endpoint

Hi Everyone,

I am currently trying to implement a simulation of barriers for wheelchair users, But I am having issues using the geojson endpoint with the avoid polygon options.

At some point, the endpoint is routing over the polygon created which must be avoided.

image as such

my request payload is this to this endpoint
https://api.openrouteservice.org/v2/directions/wheelchair/geojson

{"coordinates":[[8.536961674690248,47.37541343865293],[8.538501262664797,47.37605279697944]],"extra_info":["osmid","waytype","steepness"],"elevation":true,"instructions_format":"html","language":"en","preference":"recommended","options":{"profile_params":{"restrictions":{"maximum_incline":"0","maximum_sloped_kerb":"0.06","minimum_width":1,"surface_type":"cobblestone"},"surface_quality_known":false,"allow_unsuitable":false},"avoid_polygons":{"type":"MultiPolygon","coordinates":[[[[8.537712693214418,47.37623266105217],[8.53755657344699,47.37619830996497],[8.53746008655523,47.376108377757106],[8.537460087087755,47.375997215646805],[8.537556574308635,47.37590728378191],[8.537712693214418,47.37587293290668],[8.537868812120202,47.37590728378191],[8.537965299341082,47.375997215646805],[8.537965299873607,47.376108377757106],[8.537868812981847,47.37619830996497],[8.537712693214418,47.37623266105217]],[[8.538345694541931,47.3756913866087],[8.53818957637705,47.375657035521506],[8.538093090475703,47.37556710331366],[8.538093091008212,47.37545594120334],[8.538189577238668,47.37536600933845],[8.538345694541931,47.37533165846322],[8.538501811845196,47.37536600933845],[8.538598298075652,47.37545594120334],[8.53859829860816,47.37556710331366],[8.538501812706814,47.375657035521506],[8.538345694541931,47.3756913866087]],[[8.537369370460512,47.37580036848699],[8.537213251972974,47.3757660173998],[8.537116765872215,47.37567608519195],[8.53711676640473,47.37556492308163],[8.537213252834597,47.37547499121674],[8.537369370460512,47.37544064034151],[8.537525488086429,47.37547499121674],[8.537621974516297,47.37556492308163],[8.53762197504881,47.37567608519195],[8.537525488948052,47.3757660173998],[8.537369370460512,47.37580036848699]]]]}}}

I am not sure where the wrong part of the request is because the avoid polygon works if there is maybe 1 or 2 but if i keep on blocking the routing being generated the routing at some point does not care anymore and it does just go straight to the polygon to be avoided.

Another thing to note is that when i keep on blocking the pathways with barriers the endpoint will complain with a http error 500

and on my local ORS docker server it will have this error in the logs

Please Advise, Thank you!

So I found the issue today and it was not really about the API being wrong but my avoid polygon array coordinates in the post request.

I just realized that it needs to be using this structure.

and not everything in just one array.

1 Like