OSMfilter: How to correctly filter for all roads properly?

I want to filter the OSM US file for all the roads, basically anything that has a highway tag. I understand roads can be either ways or relations, so I tried running the following query:
–read-xml input.osm
–tf accept-ways highway=*
–tf accept-relations highway=*
–write-xml output.osm

I then searched for the nearest_edges using osmnx.nearest_edges function from the osmnx library.
I used 1000 latitude,longitude points. However, when I compared the results of using the full OSM file vs this filtered OSM file, 32 road types were missing on the filtered graph.
Any ideas on how to modify my query? I want to get the road type as small as possible?
Maybe instead of filtering highway and nodes, I can drop all buildings or cafes. Anything to make sure I don’t lose all the roads, but simplify the graph as much as possible. Thank you.

2 posts - 2 participants

Read full topic

Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/osmfilter-how-to-correctly-filter-for-all-roads-properly/104118