I am trying to generate opendrive (xodr) files from the openstreetmap data. Openstreetmap provides nodes and ways. In opendrive i need to compute the length of roads, heading angle, inertial x and y coordinates and the geometry records for the roads. Right now i am using osmnx module to visualize the road network. Can i get some help regarding the generation of geometry records?


OSMnx computes the length of streets automatically and saves as the edges' length attribute. Road geometry is the geometry edge attribute. Heading angle is computed using ox.add_edge_bearings and x,y coordinates are attributes of the two nodes incident on each edge.

import osmnx as ox
G = ox.graph_from_place('Piedmont, CA, USA', network_type='drive')
G = ox.add_edge_bearings(G)
gdf_nodes, gdf_edges = ox.graph_to_gdfs(G, fill_edge_geometry=True)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.