I export and compare the km length of the total network and then the pedestrian network via OSMnx. The strange thing is that for some cities the walk network is larger than the total network. How can this be explained? I checked the queries in the custom filter of the OSMnx code and I still can't explain it, since network='walk' is a stricter definition, thus should be contained in the all network...
Try out this code and let me know if you have any explanations.
place = 'Empire state building, New York, NY 10001, USA'
# import graph all
G_a = ox.graph_from_address(place, retain_all=True, network_type='all', simplify=True, clean_periphery=False)
# import graph walk
G_w = ox.graph_from_address(place, retain_all=True, network_type='walk', simplify=True, clean_periphery=False)
print('all: ', G_a.size(weight='length'), 'walk: ', G_w.size(weight='length'))
The
walknetwork type is fully bidirectional, meaning that each pair of adjacent nodes has at least two edges between them (there could be more than two if the nodes are directly linked by multiple street segments, as this is a MultiDiGraph), one pointing from nodeutovand the other pointing from nodevtou. Pedestrians can walk either direction on any street, so all edges must be bidirectional in a walking network.The
allnetwork type is not fully bidirectional as it makes no presumptions about who or what may flow through it. Hence, all of its edges obey one-way directionality constraints when present, meaning that some of its nodes may only be linked by a single one-way edge.This is why you may see more edges in a
walknetwork's model than in anallnetwork's model. However, yourallnetwork will always have at least as many nodes as yourwalknetwork, as you can see here:You can also see and set which
network_typearguments are treating as bidirectional with thebidirectional_network_typessetting:The
bidirectional_network_typessetting will be exposed viaox.config()in the next release of OSMnx.