How lola-sanchez-arup/city2graph-primeras-pruebas works
Project Type and Purpose
• This is an open-source geospatial data processing & graph-construction pipeline aimed at transforming urban resource datasets (fire hydrants, swimming pools, lagoons, etc.) into analyzable graphs for emergency services planning, risk analysis, route optimization, and interactive mapping.
• It is not a traditional full-stack app; rather it is a data-centric tool that reads GeoJSON sources, applies spatial graph algorithms, and outputs serialized graphs and visualizations.
File Structure Analysis
• data/
• Raw GeoJSON files (hidrantes.geojson, piscinas.geojson, laguna.geojson).
• Placeholder for future datasets (otros_datasets/).
• scripts/
• conexion_hidrantes_piscinas.py → builds a KNN graph via City2Graph + PyG.
• conexion_hidrantes_laguna_folium.py → builds a proximity graph via NetworkX + Folium.
• outputs/
• Serialized graph artifacts (.pt, .json, .pt).
• Static/interactive visualizations (.png, .html).
• requirements.txt → defines Python dependencies (GeoPandas, City2Graph, NetworkX, torch-geometric, Folium, etc.)
Key Architectural Patterns & Components
a. Data Ingestion Layer
• GeoPandas reads GeoJSON → produces GeoDataFrames.
b. Graph Construction Layer
• City2Graph for K-nearest neighbors graph.
• NetworkX for distance-threshold proximity graph.
c. Feature Engineering & Serialization
• StandardScaler for normalization.
• torch_geometric.data.Data for PyG graph objects.
• JSON for categorical mappings.
d. Visualization Layer
• Matplotlib/seaborn (static PNG).
• Folium (interactive HTML).
e. Artifacts Store
• outputs/ directory as a data sink.