I am trying to extract information about walking trails using OSMnx, i.e. footways and paths that do not run adjacent to a road as sidewalk.
My existing code is:
def graph_network(cf, coords, area = 10**10):
north, south = coords[0], coords[1]
east, west = coords[2], coords[3]
G = ox.graph_from_bbox(
north, south, east, west,
network_type = None,
simplify = True,
retain_all = True,
truncate_by_edge = True,
clean_periphery = False,
custom_filter = cf)
G_proj = ox.project_graph(G)
stats = ox.stats.basic_stats(G_proj, area = area)
return stats
coords = 38, 37, -122, -123
width = haversine_function(coords[2], coords[0], coords[3], coords[0])
length = haversine_function(coords[2], coords[0], coords[2], coords[1])
stats = graph_network(cf, coords, area = width * length)
The problem is how to choose the custom_filter, and have been trawling the OSM wiki to try and work this one out.
It seems walking networks are defined as network=iwn|nwn|rwn|lwn, but I can't see how to write this as a valid custom filter.
As an alternative I have been using cf = '["highway"~"path|track"]' as it seems the main walking classification in towns is ["highway"~"footway"] (according to https://wiki.openstreetmap.org/wiki/Hiking).
My question is:
How can I directly load only walking trails (and not sidewalk in towns)?
If anyone has any experience with this, I'd really appreciate a pointer or two.