Overview of City2Graph
mainCity2Graph is a Python library designed to transform geospatial data into spatial and heterogeneous graphs for network analysis, urban research, and Graph Neural Networks (GNNs). It acts as a bridge between several key geospatial and graph libraries:
- GeoPandas: For geospatial data manipulation.
- NetworkX: For traditional network analysis.
- PyTorch Geometric: For Graph Neural Networks (GNNs).
Key capabilities include:
- Morphology: Creating graphs from buildings, streets, and urban fabric (OSM/Overture Maps).
- Transportation: Loading GTFS and GBFS feeds into DuckDB and aggregating them into transit graphs.
- Mobility: Representing origin-destination matrices and flow data as weighted spatial graphs.
- Proximity/Contiguity: Generating KNN, Delaunay, Gilbert, and Waxman graphs, or queen/rook contiguity under various distance metrics (Euclidean, Manhattan, or network).
- Heterogeneous Graphs: Supporting multiple node and edge types with metapath-derived relations.
- GNN Integration: Providing round-trip conversion between GeoDataFrames, NetworkX, and PyTorch Geometric
Data/HeteroDatatensors.