Plotting/importing OSMnx 中的河流

Plotting/importing rivers in OSMnx

我发现有人问过如何plot/import道路以外的物体,但he/she没有得到答案。

这里是link:Plotting different area objects in OSMnx

我能够 download/install OSMnx 和 运行 OSMnx 的例子在“https://github.com/gboeing/osmnx-examples.git”。

我的兴趣是水(即河流、水库、湖泊等)。

如何从 Python 导入和绘制 river/reservoir/lake 的 Open Street Map?

我没有使用 OSMnx 的经验,但我想你可以下载一个常用的 OSM extracts and filter it. For example by using osmium-tool and extracting elements tagged with natural=water or waterway=*。然后导入OSMnx.

根据 ,对水道进行建模和绘制:

import osmnx as ox
ox.config(use_cache=True, log_console=True)
G = ox.graph_from_place('Amsterdam', retain_all=False, truncate_by_edge=False,
                        simplify=True, custom_filter='["waterway"~"canal"]')
fig, ax = ox.plot_graph(G)

this example 中提供了更多详细信息。