使用 OSMnx,我希望能够保存具有曲率的路径,如下图所示。
import osmnx as ox
import networkx as nx
# Download the road network
G = ox.graph_from_place('Monterey, California', network_type='drive')
# Starting and ending point of a trip
start = [36.580665,-121.8297467]
end = [36.594319,-121.8727587]
# Retrieve nearest node
orig_node = ox.get_nearest_node(G, start)
dest_node = ox.get_nearest_node(G, end)
# Compute the path of the trip
route = nx.shortest_path(G, orig_node, dest_node, weight='length')
# Plot the trip
fig, ax = ox.plot_graph_route(G_projected,
route,edge_linewidth=1,
node_size=20,
fig_height=20,route_linewidth=10)
显然,我可以保存路由 python 列表,但我会丢失路径的曲率,因为路由列表包含的节点较少。是否可以以谷歌折线格式或类似的格式保存显示的红色路线以保存其弯曲形状?