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
walk
network 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 nodeu
tov
and the other pointing from nodev
tou
. Pedestrians can walk either direction on any street, so all edges must be bidirectional in a walking network.The
all
network 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
walk
network's model than in anall
network's model. However, yourall
network will always have at least as many nodes as yourwalk
network, as you can see here:You can also see and set which
network_type
arguments are treating as bidirectional with thebidirectional_network_types
setting:The
bidirectional_network_types
setting will be exposed viaox.config()
in the next release of OSMnx.