使用 osmnx 绘制路线
我正在尝试开发一个代码来使用 osnmx 在地图中绘制路线。这就是我所拥有的:
route=[292257954, 429200554, 1187086228, 1179868692, 430284828]
fig, ax = ox.plot.plot_graph_route(G_map, route, route_color='r', route_linewidth=4, route_alpha=0.5, orig_dest_size=100, ax=None)
在路由列表中,我将节点写为 OSM 的 ID。但我收到此错误:
fig, ax = ox.plot.plot_graph_route(G_map, route, route_color='r', route_linewidth=4, route_alpha=0.5, orig_dest_size=100, ax=None)
File ~\anaconda3\envs\ox\lib\site-packages\osmnx\plot.py:303 in plot_graph_route
data = min(G.get_edge_data(u, v).values(), key=lambda d: d["length"])
AttributeError: 'NoneType' object has no attribute 'values'
有人可以帮助我吗?
I'm trying to develop a code to plot a route in a map with osnmx. This is what I have:
route=[292257954, 429200554, 1187086228, 1179868692, 430284828]
fig, ax = ox.plot.plot_graph_route(G_map, route, route_color='r', route_linewidth=4, route_alpha=0.5, orig_dest_size=100, ax=None)
In the route list, I have the nodes written as IDs of OSM. But i get this error:
fig, ax = ox.plot.plot_graph_route(G_map, route, route_color='r', route_linewidth=4, route_alpha=0.5, orig_dest_size=100, ax=None)
File ~\anaconda3\envs\ox\lib\site-packages\osmnx\plot.py:303 in plot_graph_route
data = min(G.get_edge_data(u, v).values(), key=lambda d: d["length"])
AttributeError: 'NoneType' object has no attribute 'values'
Could anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
完整代码后其中一个节点不存在
full code