I'm trying to save the route to the disk which i plotted using OSMNX. The route generated follows the road path but, when i try to convert the path to LineString which I can easily save to disk, the route is changed in a manner where it doesn't follow the road which you can compare among two image.
ORIGIN_point = (13.013206, 77.670987)
DESTINATION_point= (12.821339, 77.678500)
G = ox.graph_from_point(ORIGIN_point, distance=10000, distance_type='network', network_type='drive')
ORIGIN_node = ox.get_nearest_node(G, ORIGIN_point)
DESTINATION_node = ox.get_nearest_node(G, DESTINATION_point)
# find the route between these nodes then plot it
route = nx.shortest_path(G, ORIGIN_node, DESTINATION_node, weight='length')
This route is plotted using osmnx for shortest path IMAGE-1
from shapely.geometry import LineString, Point
graph_proj = ox.project_graph(G)
nodes_proj, edges_proj = ox.graph_to_gdfs(graph_proj, nodes=True, edges=True)
route_nodes = nodes_proj.loc[route]
# Create a geometry for the shortest path
route_line = LineString(list(route_nodes.geometry.values))
route is now converted to lineStringIMAGE-2
I want to save the route to disk in a shapefile, help me with that.