caesar0301 / s2g

(S)hapefile to(2) (G)raph/network converter in Python
https://pypi.python.org/pypi/s2g
MIT License
24 stars 8 forks source link

How to store node information #9

Closed curiosity654 closed 4 years ago

curiosity654 commented 4 years ago

After I have converted shapefile to a nx graph, the information in the shapefile (e.g road name, coordinates) seems to be omitted. So how can I obtain the information? I need them to map the graph back to the shapefile.

curiosity654 commented 4 years ago

I figured it out, just use the props param. Thank you for this library!

GardarGardarsson commented 3 years ago

Hi! Can you perhaps elaborate a bit on how you use the props parameter to create the networkx graph object?

curiosity654 commented 3 years ago

Hi! Can you perhaps elaborate a bit on how you use the props parameter to create the networkx graph object?

Sorry for the delayed reply, it's been a while since I used this package, I think props should be a member of the created graph object using s2g, you can try to inspect the created object using debug mode.

GardarGardarsson commented 3 years ago

Many thanks for coming back on this. I ended up going a different route, where I use GeoPandas for importing the .shp file and momepy for converting the GeoDataFrame into a networkx graph. I still might come back to this and verify if s2g does a better job of the graph conversion.