Skip to content

Instantly share code, notes, and snippets.

@fhk
Created August 20, 2024 01:03
Show Gist options
  • Save fhk/c7e5d50e6170858263121667b0001375 to your computer and use it in GitHub Desktop.
Save fhk/c7e5d50e6170858263121667b0001375 to your computer and use it in GitHub Desktop.
gemini_geograph.py
import momepy
import geopandas as gpd
def create_graph(linestrings):
gdf = gpd.GeoDataFrame(geometry=linestrings)
graph = momepy.gdf_to_nx(gdf, approach="primal")
return graph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment