python osmnx - 仅提取一个国家的大型高速公路

问题描述 投票:0回答:1

我知道可以通过 OSMNX python 包提取城市的道路网络。详情请参阅 https://geoffboeing.com/2016/11/osmnx-python-street-networks/ .

paris_network = ox.gdf_from_place("Paris")

但是,假设我不想要那种高细节,而只想要整个国家的大型高速公路。我正在寻找类似的东西:

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

我想这可能来自“基础设施”的说法,但作为一个新手,我真的不知道如何准确地使用它。

python openstreetmap osmnx
1个回答
10
投票

是的,您可以使用 OSMnx 来做到这一点:

import osmnx as ox
ox.settings.log_console = True
cf = '["highway"~"motorway"]'
G = ox.graph_from_place('France', network_type='drive', custom_filter=cf)
fig, ax = ox.plot_graph(G)

如果您想按多个高速公路标签值进行过滤(例如,保留所有高速公路和主要道路),另请参阅此答案

请参阅 OSMnx 文档了解更多使用细节。

© www.soinside.com 2019 - 2024. All rights reserved.