【发布时间】:2020-08-21 02:26:22
【问题描述】:
在 Python 中,我们可以使用函数 osmnx.graph_from_place() 和过滤器 custom_filter='["waterway"="river"]' 来获得过滤后的图。
import osmnx as ox
G = ox.graph_from_place("isle of man", custom_filter='["waterway"="river"]') # download directly.
fig, ax = ox.plot_graph(G, node_color='r')
我想从我的磁盘上的 OSM 格式的 XML 文件中获取过滤图,但函数 osmnx.graph_from_xml() 不支持参数 custom_filter。如何从 *.osm 数据中获取过滤后的图?
这只会绘制整个 *.osm 数据集:
import osmnx as ox
G = ox.graph_from_xml("isle-of-man-latest.osm") # from disk.
fig, ax = ox.plot_graph(G, node_color='r')
【问题讨论】:
标签: python openstreetmap osmnx