在OSMNX中的2个点之间着色
在下面的代码中,我会在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')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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