在OSMNX中的2个点之间着色

发布于 2025-01-24 04:02:02 字数 633 浏览 0 评论 0 原文

在下面的代码中,我会在2分之间创建一个路径,并且在运行它时,该路径为蓝色。我一直在尝试更改颜色,但我无法弄清楚。 有人可以帮我吗? 谢谢你!

代码:

import folium
import osmnx as ox
import networkx as nx

ox.config(use_cache=True, log_console=True)

G = ox.graph_from_point((32.206555, 34.884147),  
dist=3000, network_type='drive', simplify=False)

G = ox.speed.add_edge_speeds(G)
G = ox.speed.add_edge_travel_times(G)

orig = ox.get_nearest_node(G, (32.206555, 34.884147))
dest = ox.get_nearest_node(G, (32.225284, 34.882921))
route = nx.shortest_path(G, orig, dest, 'travel_time')

route_map = ox.plot_route_folium(G, route)
route_map.save(r'path/to/save/map.html')

In my code below I'm creating a path between 2 points and when I run it, the path is blue. I've been trying the change the color but I couldn't figure it out.
can someone help me, please?
Thank you!

The code:

import folium
import osmnx as ox
import networkx as nx

ox.config(use_cache=True, log_console=True)

G = ox.graph_from_point((32.206555, 34.884147),  
dist=3000, network_type='drive', simplify=False)

G = ox.speed.add_edge_speeds(G)
G = ox.speed.add_edge_travel_times(G)

orig = ox.get_nearest_node(G, (32.206555, 34.884147))
dest = ox.get_nearest_node(G, (32.225284, 34.882921))
route = nx.shortest_path(G, orig, dest, 'travel_time')

route_map = ox.plot_route_folium(G, route)
route_map.save(r'path/to/save/map.html')

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

原野 2025-01-31 04:02:02

OX.PLOT_ROUTE_FOLIUM的ROUTE_COLOR =已弃用: https://osmnx.readthedocs.io/en/stable/osmnx.html?highlight=plot_rout_rout_route #osmnx.folium.plot_route_folium 但是您可以使用Kwargs - for for fol for for folium.polyium.polyline.polyline.polyline.pollineline.plineline.plineline())例如颜色=“#cc0000”,重量= 5,不透明度= 0.7

ox.plot_route_folium 's route_color= has been deprecated: https://osmnx.readthedocs.io/en/stable/osmnx.html?highlight=Plot_route#osmnx.folium.plot_route_folium but you can use of the kwargs – keyword arguments to pass to folium.PolyLine() for example color=”#cc0000”, weight=5, opacity=0.7

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文