python osmnx-仅提取一个国家的大型高速公路 [英] python osmnx - extract only big freeways of a country
问题描述
我知道可以通过OSMNX python软件包提取城市的道路网.在 https://geoffboeing.com/2016/11/osmnx-中查看详细信息python-street-networks/.
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.
推荐答案
是的,您可以使用OSMnx执行此操作:
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='drive', infrastructure='way["highway"~"motorway"]')
fig, ax = ox.plot_graph(G)
如果您想按多种高速公路类型(例如,保留所有高速公路和主要高速公路)进行过滤,另请参见此答案.道路).
See also this answer if you'd like to filter by multiple highway types (e.g., retain all motorways AND primary roads).
这篇关于python osmnx-仅提取一个国家的大型高速公路的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!