Retrieve Post Covid Pop-up Cycleways With Openstreetmap And Osmnx
The OSM community in Italy has started to update OSM with 'emergency' or 'pop-up' cycleways that many administration are creating to guarantee social distancing while public transp
Solution 1:
You can query with OSMnx for way tag/value combos, just as described in the documentation and usage examples. As you can see on OSM, for example, the tag is cycleway:right
and its value is lane
.
import networkx as nx
import osmnx as ox
ox.config(use_cache=True)
place = 'Bologna, Italia'# get everything with a 'cycleway' tag
cf = '["cycleway"]'
G = ox.graph_from_place(place, custom_filter=cf)
print(len(G))
# get everything with a 'cycleway:left' tag
cf = '["cycleway:left"]'
G = ox.graph_from_place(place, custom_filter=cf)
print(len(G))
# get everything with a 'cycleway:right' tag
cf = '["cycleway:right"]'
G = ox.graph_from_place(place, custom_filter=cf)
print(len(G))
# get everything with a 'cycleway:right' tag if its value is 'lane'
cf = '["cycleway:right"="lane"]'
G = ox.graph_from_place(place, custom_filter=cf)
print(len(G))
# get everything with a 'cycleway:right' or 'cycleway:left' tag
cf1 = '["cycleway:left"]'
cf2 = '["cycleway:right"]'
G1 = ox.graph_from_place(place, custom_filter=cf1)
G2 = ox.graph_from_place(place, custom_filter=cf2)
G = nx.compose(G1, G2)
print(len(G))
see also https://stackoverflow.com/a/61897000/7321942 and https://stackoverflow.com/a/62239377/7321942 and https://stackoverflow.com/a/62720802/7321942
Post a Comment for "Retrieve Post Covid Pop-up Cycleways With Openstreetmap And Osmnx"