-->

python osmnx - extract only big freeways of a coun

2019-05-29 10:06发布

问题:

I know it is possible to extract the road network of a city via the OSMNX python package. See details at https://geoffboeing.com/2016/11/osmnx-python-street-networks/ .

paris_network = ox.gdf_from_place("Paris")

But, let's say I do not want that level of high details, but rather only big freeways of a whole country. I'm looking for something like :

france_big_expressway_network = ox.gdf_from_place("France", road_type = "freeway")

I guess it might comes from the "infrastructure" argument but as a newbie I really do not get how to use it precisely.

回答1:

Yes you can do this with OSMnx:

import osmnx as ox
ox.config(use_cache=True, log_console=True)
G = ox.graph_from_place('France', network_type='none', infrastructure='way["highway"~"motorway"]')
fig, ax = ox.plot_graph(G)