Avoid_features Tollways is ignored on self-hosting instance

Hello! I am running my own ORS docker instance with geofabrik maps extracts (.osm.pbf format) from different states in the US, everything works correctly, but I am encountering this issue in which when I am trying to apply avoid_features:[“tollways”] it is ignored and i get the same route as a response (as if the feature was not being applied).
The profile I am using is “driving_hgv” and I am attempting the following request:

url = "http://localhost:8080/ors/v2/directions/driving-hgv/geojson"
    headers =  {
            'Accept': 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8',
            #'Authorization': 'key',
            'Content-Type': 'application/json; charset=utf-8'
            }
    body = {
            "coordinates": coords,
            "options":{"avoid_features":["tollways"]},
            "elevation":"true"
            }
    response = requests.post(url, headers = headers, json = body)

I’ve been looking for this problem on the forum and on github. and I found out that changing “lmsets” from "lmsets": "highways;allow_all" to "lmsets": "highways,tollways;highways;tollways;allow_all" fixes the problem for me in some test cases in which the tollways are finally being avoided. (regions from europe and some US states extracted from BBBike in .osm.pbf format). But there are still several cases in which tollways are still not being avoided. I’ve also been checking every route on OSR Maps webpage in order to be sure.

Summing up, setting “lmsets” to "lmsets": "highways,tollways;highways;tollways;allow_all" seems to have fixed this issue for some cases, as before all of the tollways were being ignored but now just some of them are the ignored ones. My hypothesis is that maybe the data i’ve been using is incomplete or lacks tollway elements in the extracted regions.

I would really appreciate any kind of help and I will include further details related to this case if asked.
Thank you very much!!!

Hey,

when running with the mentioned lmsets-settings, can you give an example query and the corresponding OSM highway where a tollway is not avoided?

I don’t know what extracts from BBBike do, whether there’s any kind of preprocessing involved - we generally recommend https://download.geofabrik.de/ for .osm.pbf-files.

If you figure that the issue is in the data extract you’re using, you can check with osmium getid your-file.osm.pbf w<osm-way-id> -f xml (or similar) what tags are present in your osm file.

Best regards

Hello! I am really sorry about the delay in my response and the length of it. I’ve been carrying out several tests the past week in order to offer clear and relevant cases.

First of all I am currently using geofabrik data .osm.pbf files (maps of Illinois, Wisconsin and Florida). I have checked that the tollway an toll-booth element tags (as ways and nodes) exist in my files by means of osmium getid your-file.osm.pbf w<osm-way-id> -f xml and indeed they do exist.

Secondly, my ors-config profile-hgv looks like this:

"profile-hgv": {
            "profiles": "driving-hgv",
            "parameters": {
              "encoder_flags_size": 8,
              "encoder_options": "turn_costs=true|block_fords=false|use_acceleration=true",
              "maximum_distance": 100000000,
              "elevation": true,
              "preparation": {
                "min_network_size": 200,
                "min_one_way_network_size": 200,
                "methods": {
                  "ch": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "recommended"
                  },
                  "core": {
                    "enabled": true,
                    "threads": 1,
                    "weightings": "recommended,shortest",
                    "landmarks": 64,
                    "lmsets": "highways,tollways;highways;tollways;allow_all"
                  }
                }
              },
              "execution": {
                "methods": {
                  "core": {
                    "disabling_allowed": true,
                    "active_landmarks": 6
                  }
                }
              },
              "ext_storages": {
                "WayCategory": {},
                "HeavyVehicle": {
                  "restrictions": true
                },
                "WaySurfaceType": {}
              }
            }
          },
          "profile-bike-regular": {
            "profiles": "cycling-regular",
            "parameters": {
              "encoder_options": "consider_elevation=true|turn_costs=true|block_fords=false",
              "elevation": true,
              "ext_storages": {
                "WayCategory": {},
                "WaySurfaceType": {},
                "HillIndex": {},
                "TrailDifficulty": {}
              }
            }
          },

Regarding the different queries attempted with their respective results, they are as follows (several cases are going to be displayed in the following lines).
Before showing all the different cases, the request looks like this, the only thing that changes is the coordinates value which will be specified on each case.

url = "http://localhost:8080/ors/v2/directions/driving-hgv/geojson"
    #The headers and the body are specified next
    headers = {
            'Accept': 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8',
            'Content-Type': 'application/json; charset=utf-8'
            }
    body = {
            "coordinates": coordinates,
            "preference":"recommended",
            "options":{
                        "vehicle_type": "hgv",
                        "avoid_features": ["tollways"],
                        },
            "elevation":"true",
            }

Each case will consist of the coordinates of origin and destination, the expected result in ORS maps and the result obtained in my self-hosted instance. (some cases will also have closeups in order to offer additional info).

Case 1:
coordinates = [[-88.34964752197267, 41.763181468505636],[-89.05736446380617, 41.91185869609155]]
The expected result looks as follows:
ORS-Aurora-Rochelle-tolls
The result looks as follows:


When requesting the same route without tollways i.e. without "avoid_features": ["tollways"] in my request body, the result looks like this:

As you can see part of the route has changed but the tollway is not being avoided at all, in addition, the first route (the one intended to avoid tolls) is requesting to perform an u-turn in the middle of the motorway in [-88.3835506439209, 41.79484027263641] as it can be seen here:


Finally, it does go through a toll plaza in [-88.87434661388397, 41.90004910010478] as it can be seen here:

Funny enough, when the route is reversed, it works perfectly (with coordinates = [[-89.05736446380617, 41.91185869609155],[-88.34964752197267, 41.763181468505636]]) as it can be seen here:

Case 2:
This case is simpler. Its coordinates are: coordinates = [[-81.26561164855958, 28.39747851254798],[-80.85413932800294, 28.367008819756055]]
The expected result is:

The result obtained is:

In the following closeup the route goues through a toll plaza as well, as it can be seen here.

Case 3:
coordinates = [[-88.07425975799562, 41.7943523480209],[-87.96559810638429, 41.50455999340773]]

The expected result looks as follows:

An the result is:

In this case, an u-turn is also being suggested in [-88.0425612974154, 41.810268214253625]:

But if i do the route from Darien [-87.9737949371338, 41.749919651791565] which is 14km away from the previous origin it works perfectly:
Route without avoid tollways option:

Route avoiding tollways:

Case 4:
coordinates = [[-81.40791893005371, 28.292364554823344],[-80.34996986389162, 27.43912637110832]]

The expected result is:
ORS-kissimmee-fortpierce

An the result obtained is:

But when the route is reversed, the result looks as follows (which is correct).
kissimmee-fortpierce-avoid- reversed route

Case 5:
In this case it has been studied the way the origin location affect the avoid tollways option, as depending on the starting location such elements (tollways) are avoided or not.

With coordinates = [[-80.62231063842775, 28.035016087665575],[-80.1471519470215, 26.304495334944882]] tollways are perfectly avoided.

With coordinates = [[-81.41199588775636, 28.297276972422726],[-80.1471519470215, 26.304495334944882]] tollways are not avoided.

With coordinates = [[-80.1471519470215, 26.304495334944882],[-81.06157064437868, 27.74788568308011]] tollways are not avoided neither.

I do not know where can my instance be failing, maybe the problem is the method (lm, ch, core) I am using (as i don’t know which one is being used by ORS Maps webpage and maybe it is different) or maybe some setting in my options is the one provoking this tollway myopia.

I would really also like to apologize for the picture spam I have caused but I was in the need of making the case as clear and thorough as possible.

Thank you very much for your help!!!
Kind regards!