为OSMnx中两个点之间的路径着色



在下面的代码中,我创建了两个点之间的路径,当我运行它时,路径是蓝色的。我一直在试着换颜色,但就是换不出来。有人能帮帮我吗?谢谢你!

代码:

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')

ox。plot_route_folium的route_color=已被弃用:https://osmnx.readthedocs.io/en/stable/osmnx.html?highlight=Plot_route#osmnx.folium.plot_route_folium但您可以使用kwargs -关键字参数传递给folium.PolyLine(),例如color= " #cc0000 ", weight=5, opacity=0.7

最新更新