Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trunk road ignored for foot or bike routing - best way to solve #6008

Open
boothym opened this issue Apr 12, 2021 · 18 comments
Open

Trunk road ignored for foot or bike routing - best way to solve #6008

boothym opened this issue Apr 12, 2021 · 18 comments
Labels

Comments

@boothym
Copy link

boothym commented Apr 12, 2021

Came across this tweet: https://twitter.com/thomasforth/status/1381702567126835201

And this example in the replies of how OSRM was seemingly ignoring the A75 trunk road for foot and bike routing from one side of town to the other: https://www.openstreetmap.org/directions?engine=fossgis_osrm_foot&route=54.90570%2C-5.01110%3B54.90420%2C-5.02350#map=16/54.9016/-5.0153 (GraphHopper routes along trunk roads)

I looked at the debug view and found that was indeed the case: http://map.project-osrm.org/debug/foot.html#17.26/54.90434/-5.01646

In case you are wondering what this road looks like: https://www.geograph.org.uk/photo/4929194 (perfectly suitable for foot/bike routing)

So my question is - what is the best way to solve this in OSM? Just add foot/bicycle=yes, sidewalk=both, separately mapped sidewalks or a combination of all three?

@danpat
Copy link
Member

danpat commented Apr 13, 2021

TBH, OSRM is wrong here. There are some default access rules defined at:

https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access_restrictions#United_Kingdom

which shows that in the UK, highway=trunk should be accessible to foot traffic by default.

@frodrigo
Copy link
Member

A way to to it is using polygons, like driving_side or maxheight.

https://github.com/Project-OSRM/osrm-backend/tree/master/data

@boothym
Copy link
Author

boothym commented Apr 13, 2021

Sorry @frodrigo, I'm not sure what you mean?

@danpat
Copy link
Member

danpat commented Apr 13, 2021

What @frodrigo means is that we should probably build up a GeoJSON that captures all these regional access restriction defaults, and make the .lua files use them so that defaults can be modified regionally.

@tombay
Copy link

tombay commented Sep 18, 2023

I logged #6701. I looked at https://wiki.openstreetmap.org/wiki/Key:motorroad
-- and https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access_restrictions.
Most of the countries that allow trunk access to bike and foot can be covered by two cases. -
1/ trunk and trunk_link is allowed &
2/ trunk and trunk_link allowed if motorroad is no or not defined. I think GBR falls into this category.
I put my attempt to cover these cases in the final note to that issue. It relies on geolocation data and covers 30 countries that meet the criteria.
e.g. osrm-extract -p /usr/local/share/osrm/profiles/foot.lua --location-dependent-data=.countries.geojson ...
A real solution would of course cover all the other scenarios but for me at least it allowed bike (and foot) trails for NZ without having to add tags to the osm data.
Ciao
Tombay

@frodrigo
Copy link
Member

@tombay maybe you wan to contribute a PR to add this features and polygons to OSRM itself ?

@tombay
Copy link

tombay commented Sep 18, 2023 via email

Copy link

github-actions bot commented Jul 8, 2024

This issue seems to be stale. It will be closed in 30 days if no further activity occurs.

@github-actions github-actions bot added the Stale label Jul 8, 2024
@frodrigo frodrigo removed the Stale label Jul 8, 2024
@frodrigo
Copy link
Member

frodrigo commented Jul 8, 2024

This issue seems to be stale. It will be closed in 30 days if no further activity occurs.

The idea is still interesting.

@tombay
Copy link

tombay commented Jul 9, 2024

I created a PR #6703 (Sep 2023) which addressed this issue. A subsequent PR (#6708) seemed to cause an issue with my PR and it is languishing. It does include a 3.6 mb geojson file which outlines the countries affected. I thought having to traverse this file for each way (and node ?) would be a no no so approached it via
--location-dependent-data data/trunk_allowed.geojson. (and the associated country list in lua file). Maybe there is another approach.
%-?

@tombay
Copy link

tombay commented Jul 15, 2024

I have written (hacked??) a script to parse the tables in
"https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access_restrictions"
(Still a work in progress).
It generates a .lua script - Set of countries, and a Sequence of Sequences for Country->Profile->Highway Tag.
This could be used to cover all country specific highway types (not just trunk).
The parsing resulted in around 5500 "cells" of which ~4800 are "yes" or "no". 126 are empty. The empty ones are cases like Belarus->motorcycle->goods=(5). Comment 5 says that servicing, local access and moving of vehicles are o.k.

There are 31 countries and using data from The Natural Earth ne_10m_admin_0_countries data, the resulting geojson file is about 7.7meg. According to "https://wiki.openstreetmap.org/wiki/Precision_of_coordinates#Conversion_to_decimal" 10 metre accuracy is covered by dd.dddd. By reducing the ne data to dd.ddddd, and trimming feature data, the size can be reduced to ~4meg.

General assumptions for the script was if there is an access type (yes,no,designated...) then drop any notes. To address the 126 empties is it better to say "no" or "yes" - or "maybe".
I think that is a question for a routing type or Chat Gpt %-)

"Cells within cells within cells" (Dekard in Blade Runner_2049).

@tombay
Copy link

tombay commented Aug 4, 2024

I can see no association with access nodes and countries and so have been looking at ways - speed handling.
In the foot.lua profile the setup has a component speeds = Sequence { ...
If you separate this into say hwyspeeds and other speeds (e.g. from railway down) then you can have a unique hwyspeed set for each country.
I have parsed the Access Restrictions and generated lua code to handle it. It includes a 'Worldwide' set to cover all the other countries not mentioned in the Restrictions page.
To do this one needs to run the extract with location-dependent-data. Using "https://osm-boundaries.com/map" as the source of the country geometry data results in a data file of around a 41M. Trying other poly data (eg naturalearth or geofabrik poly maps) did not accurately reflect country borders. The complete file is not needs if you are only building a subset of the world.
I have only looked at the foot profile as the bicycle one is more convoluted. I will create a new PR to add the code.

@tombay
Copy link

tombay commented Sep 14, 2024

I have created a PR in Project OSRM /osrm-backend (#6710) that addresses the issue. It enables the use of --location-dependent-data to create datasets.

The PR is awaiting review (if anyone is interested)

I created profiles countryfoot.lua and countrybicycle.lua that make use of the feature.
I have a geojson file that covers all the countries as listed in https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Access_restrictions.
I did not add it to the code as it is ~ 42Meg (13.5 gzipped).

@frodrigo
Copy link
Member

I still interested to review the PR (but few free time right now).

The geojson is available somewhere ? The other geojson in the project are light, but maybe over simplified.

One solution maybe to include a simplified geojson and the lua code directly into the profiles.

@tombay
Copy link

tombay commented Sep 16, 2024

I have added .../test/data/nominatimosm.geojson.gz (~13.8meg)
which is a gzipped file of the 32 countries. I extracted the polygons from nominatim.openstreetmap.org.
For testing I created a countrytest.geojson to support cucumber testing.

@frodrigo
Copy link
Member

You need the merge the countries to avoid useless inner borders. Then you need to over simplify the shore border. Finally you can simplify the geometries. Look at the other geojson file already included.

Simpler geojson are smaller, but also allows faster point in polygon runtime.

@tombay
Copy link

tombay commented Sep 17, 2024

I created a geojson file based from poly files at download.geofabrik.de. (.../test/data/geofabrikpoly.geojson)
From your last point do you mean that routing runtime performance is affected by polygon count ?

@frodrigo
Copy link
Member

frodrigo commented Sep 17, 2024

I merged the countries for you using JOSM. But my file have too much decimals, should be keep to 6 (like you file).
geofabrikpoly-merged-.geojson.gz

tombay added a commit to tombay/osrm-backend that referenced this issue Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants