Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gboeing committed Nov 24, 2024
1 parent 1fb7132 commit cc1ff4a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions osmnx/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ def graph_to_gdfs(
u, v, k, data = zip(*G.edges(keys=True, data=True))

if fill_edge_geometry:
coords = {n: (G.nodes[n]["x"], G.nodes[n]["y"]) for n in G}
node_coords = {n: (G.nodes[n]["x"], G.nodes[n]["y"]) for n in G}
edge_geoms = (
edata.get("geometry", LineString((coords[u], coords[v])))
for u, v, _, edata in G.edges(keys=True, data=True)
d.get("geometry", LineString((node_coords[u], node_coords[v])))
for u, v, _, d in G.edges(keys=True, data=True)
)
gdf_edges = gpd.GeoDataFrame(data, crs=crs, geometry=list(edge_geoms))

Expand Down

0 comments on commit cc1ff4a

Please sign in to comment.