Specify highway types: avoid motorways
Closed this issue · 2 comments
keep from trying to route us onto roads inappropriate for running.
Problem: in the current settings runners are routed onto highways
which are definitely unsuitable for runners e.g. motorway
Solution: Specify custom_filter
in osmnx.graph.graph_from_polygon
[1], for an inspiration can be use CityStrides Street Query [2].
osmnx.graph.graph_from_polygon(polygon, network_type='all', simplify=True, retain_all=False, truncate_by_edge=False, clean_periphery=True, custom_filter=custom_filter)
References
[1] OSMnx docs
https://osmnx.readthedocs.io/en/stable/osmnx.html?highlight=custom%20filter#osmnx.graph.graph_from_polygon
[2] CityStrides Street Query
https://docs.google.com/spreadsheets/d/1dbj5giwBhCG-jWmokCnQOJhkIEE132FvXVyrvDL7tSU/edit#gid=1943684409
Thanks for opening this issue. You may also find it helpful to see how the existing filters(drive,walk, etc.) are defined to modify, and that can be found in the downloader.py file in the OSMNX repo.
downloader.py
I added following filters 👇, it seems to filter the motroway
out.
CUSTOM_FILTER = (
f'["highway"]["area"!~"yes"]["highway"!~"bus_guideway|bus_stop|construction|cycleway|elevator|footway|'
f'motorway|motorway_junction|motorway_link|escalator|proposed|construction|platform|raceway|rest_area|'
f'path|service"]["access"!~"customers|no|private"]["public_transport"!~"platform"]'
f'["fee"!~"yes"]["foot"!~"no"]["service"!~"drive-through|driveway|parking_aisle"]["toll"!~"yes"]'
)
It should be live on the www.everystreetchallenge.com.
Thanks for you report and time!