Precise route query with avoid_polygons parameter not possible

Hi everyone,

I’m currently trying to perform very precise directions-queries with the avoid_polygons parameter. I’m querying routes from different critical infrastructures on both sides of level-crossings. Unfortunately, the endpoint I specify is repeatedly moved to a location I did not intend, in the case shown below even across a blocked road (= railway-track). This happens even though I use endpoints that correspond exactly to points in the OSM network. If I restrict the radius of the endpoint to 10m, no routable point is found:

Could not find routable point within a radius of 10.0 metres of specified coordinate 1: 9.0152919 50.0789229.

What logic is used to search for a routable point? Isn’t every point within the OSM road network routable?

I host a local ORS image in Docker and use an OSM dataset for Germany. The endpoints of the routes I query come from the OSM road network with the same status as the dataset used in Docker. I can therefore say with almost certainty that this point can be found within the road linestring (see Way: ‪Königsberger Straße‬ (‪46171903‬) | OpenStreetMap).

The image shows the blocked road section as one of several polygons, as well as the course of the road as a linestring. As the polygon is formed based on the level-crossing that is part of the road network, it should be ensured that the polygon blocks at least one point of the road network. My query endpoints are the corner points of the road linestring.

Queries:

{
    "coordinates": [[9.0505175, 50.0876257], [9.0154265, 50.0787722]],
    "continue_straight": false,
    "options": {
      "avoid_polygons": {
        "type": "MultiPolygon",
        "coordinates": [
          [[[9.015349762719822, 50.07887688784149], [9.01554332905168, 50.078978880666305], [9.015553184260508, 50.07897582721316], [9.015550130807368, 50.07896597200433], [9.015356437280179, 50.07886391215851], [9.01516077026376, 50.078765688875365], [9.015150977136996, 50.07876893593331], [9.015154224194943, 50.078778729060076], [9.015349762719822, 50.07887688784149]]],
          [[[9.012406754255899, 50.0771408030998], [9.0125869640696, 50.077265017473714], [9.012597111239083, 50.07726315101487], [9.012595244780238, 50.07725300384539], [9.012415045744103, 50.077128796900205], [9.012235069852064, 50.07700426683893], [9.012224919350086, 50.07700611508855], [9.012226767599714, 50.07701626559053], [9.012406754255899, 50.0771408030998]]],
          [[[9.003130821784923, 50.07792709586208], [9.003324675974335, 50.07782532785187], [9.003327744416803, 50.07781547729971], [9.003317893864638, 50.07781240885724], [9.003124178215076, 50.07791410413792], [9.002928326262028, 50.07801162180599], [9.002925047280435, 50.078021404290176], [9.002934829764621, 50.07802468327177], [9.003130821784923, 50.07792709586208]]],
          [[[9.027307379162197, 50.08510534331047], [9.02750903181854, 50.085190898415], [9.027518597272039, 50.08518703178643], [9.027514730643471, 50.08517746633293], [9.027313420837801, 50.08509205668954], [9.027116730456589, 50.084996488185524], [9.027106980197978, 50.08499986178511], [9.027110353797562, 50.08500961204372], [9.027307379162197, 50.08510534331047]]]
        ]
      }
    },
    "preference": "fastest",
    "radiuses": [10, 10]
  }

and with the second endpoint:

"coordinates": [[9.0505175, 50.0876257], [9.0152919, 50.0789229]]

In order to understand the unintended displacement of the endpoint, the radius parameter must be removed as described above.

Is there any way to navigate exactly to the endpoints I have selected without the points being offset? Why can no routable point be found, although the point is definitely accessible despite some polygons being blocked?

Thanks in advance and best regards
Marco

Hi @marco-s,

for different profiles different ways are routable.
Please check our tag filtering for details.

As the way does have the highway=residential tag and no other restricting tags, it should be routable.

An issue i get with your avoid polygons: they are not following the right-hand rule. Check them on geojson.io.
But that probably is not the issue with the query.

It could be that during the request, it won’t use ways covered by the avoid area and thus also can’t find the point on it ?

Maybe @andrzej or @sascha can give insights on this :slight_smile:

Best regards

1 Like

Hi @amandus,

thanks for your quick answer. Locally I use the standard driving-car config. However, the problem also occurs via the API, the body shown above is copied from the ORS API playground.

I’ve checked the polygons, they seem to be placed correctly. In my current workflow, I block all level-crossings within a certain radius, so thanks for the tip - never heard of the right-hand rule :wink:

It sounds plausible that blocked ways are blocked completely and not just individual nodes - however, my feeling is that this has often worked like this in the past.

Another similar example shows that the end point has been placed correctly this time, but the route still leads through the blocked polygon (ORS API playground body again):

{
  "coordinates": [[8.84332194, 50.15168431], [8.8678246, 50.1436239]],
  "continue_straight": false,
  "options": {
    "avoid_polygons": {
      "type": "MultiPolygon",
      "coordinates": [
        [[[8.867847313031294, 50.14365961121311], [8.868065974537593, 50.1436692019446], [8.868072943351475, 50.143676810121136], [8.86806533517494, 50.14368377893502], [8.867846686968704, 50.14367418878689], [8.867628021624773, 50.143664997830875], [8.86762103893261, 50.143657402389664], [8.867628634373828, 50.1436504196975], [8.867847313031294, 50.14365961121311]]]
      ]
    }
  },
  "preference": "fastest"
}

If I want to prevent the displacement of the end point by adding a radius (e.g. "radiuses": [50, 10]), no routable point can be found again. So it doesn’t seem to be one specific road that is the problem.

Best regards