You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our networkx graphs were initially (in 2019) compatible with osmnx graphs. Right now, they are slightly different because the structure on the osmnx side has changed. I suggest adding a osmnx_like keyword to gdf_to_nx which tries to mimic the structure of osmnx graph (mostly adding arbitrarily generated osmid).
Value / benefit
The graph created with gdf_to_nx(osmnx_like=True) can be consumed by any osnmx function. Right now, it sometimes doesn't work.
Implementation details
New keyword, defaulting to False.
We need to check how exactly should the graph look like (I am not fully sure).
Tasks to complete
Once this is done, we also need to ensure that all our graph functions work on both of these objects, no matter the osmnx_like keyword.
The text was updated successfully, but these errors were encountered:
From our conversation today I remembered I had actually done something like this already for my own stuff. So I made a first attempt at how it would look in momepy. see here
At the moment it only makes a MultiDirectedGraph since that is what osmnx.graph_from_gdf() does. However, if you want an undirected graph then it should also add the from and to columns.
From osmnx documentation documentation there are only three requirements so a graph can be used with their functions.
However, you can convert arbitrary node and edge GeoDataFrames as long as 1) gdf_nodes is uniquely indexed by osmid, 2) gdf_nodes contains x and y coordinate columns representing node geometries, 3) gdf_edges is uniquely multi-indexed by u, v, key (following normal MultiDiGraph structure). This allows you to load any node/edge shapefiles or GeoPackage layers as GeoDataFrames then convert them to a MultiDiGraph for graph analysis. Note that any geometry attribute on gdf_nodes is discarded since x and y provide the necessary node geometry information instead.
I also ignored the oneway argument in this first attempt.
Description / Summary
Our networkx graphs were initially (in 2019) compatible with osmnx graphs. Right now, they are slightly different because the structure on the osmnx side has changed. I suggest adding a
osmnx_like
keyword togdf_to_nx
which tries to mimic the structure of osmnx graph (mostly adding arbitrarily generatedosmid
).Value / benefit
The graph created with
gdf_to_nx(osmnx_like=True)
can be consumed by any osnmx function. Right now, it sometimes doesn't work.Implementation details
New keyword, defaulting to False.
We need to check how exactly should the graph look like (I am not fully sure).
Tasks to complete
Once this is done, we also need to ensure that all our graph functions work on both of these objects, no matter the
osmnx_like
keyword.The text was updated successfully, but these errors were encountered: