Itamar Nahum
Itamar Nahum

Reputation: 1

Colorize a path between 2 points in OSMnx

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

Upvotes: 0

Views: 306

Answers (1)

JoScratcherJo
JoScratcherJo

Reputation: 100

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

Upvotes: 2

Related Questions