How appliedmechanics-eafit/urban_morphology works
Project type and purpose
• This is a standalone geospatial data‑analysis pipeline (open‑source tool) for “urban_morphology.”
• It ingests shapefiles and Excel data (“Data_ABC”), fetches and caches street networks (via OSMnx), computes graph‑theoretic metrics (centralities, clustering), and emits cleaned data, metric tables, geojsons, and interactive HTML visualizations.
File structure
Top‑level “Code/” directory breaks down into:
• Data_ABC/ – raw Excel inputs and cleaned versions
• Poligonos_Medellin/ – input shapefiles, derived geojson, and all per‑polygon results (subfolders for static stats, disaggregated measures, clustering outputs)
• cache/ – JSON files caching OSMnx network responses
• Graphs_Cities/ – HTML outputs for each centrality measure by city
• Metrics_City/ – consolidated Excel sheets of computed metrics
• Cleaning & orchestration scripts:
– cleaning_DATA_ABC.py
– Poligonos_Medellin.py (loads shapefiles, drives spatial joins)
– network_Indicators.py (fetch + compute network metrics)
– Main.py (top‑level pipeline runner)
– Lecture.py (likely presentation‐style demo or plotting)
README insights
• Minimal—but name “urban_morphology” confirms tool’s focus on city form analysis.
Main components & interactions
1. Input Data Layer
– Excel reader (Data_ABC/*.xlsx)
– Shapefile reader (Poligonos_Medellin/*.shp → GeoDataFrame)
2. Preprocessing Module
– cleaning_DATA_ABC.py → cleans raw Excel → cleaned CSV/Excel
3. Network Engine
– network_Indicators.py
• Calls OSMnx to pull street network → caches JSON in Code/cache
• Uses networkx to compute centralities (degree, betweenness, closeness, pagerank, eigenvector, local scaling)
4. Polygon Processor
– Poligonos_Medellin.py
• Takes cleaned data + network metrics + geometry → spatial joins → per‐polygon stats
5. Orchestrator
– Main.py
• Invokes preproc → network engine → polygon processing → graph generator
6. Visualization Layer
– Generates HTML in Graphs_Cities/ and geojson in Poligonos_Medellin/Json_files
– Lecture.py for summary plots/tables
7. Output Stores
– Code/Resultados (urban patterns cluster)
– Poligonos_Medellin/Resultados (Excel, CSV, TXT, geojson)
– Metrics_City (Excel metrics)
– Graphs_Cities (interactive HTML)
– Raw Excel → Preprocessing → cleaned CSV/Excel
– Cleaned CSV + Shapefile → Polygon Processor
– Polygon Processor requests street network → Network Engine → OSM API (external)
– Network Engine caches API responses → Code/cache
– Network metrics → back to Polygon Processor → per‐polygon tables
– Outputs → Visualization Layer → HTML & geojson → Output Stores
C. Architectural patterns & principles
– Separation of concerns: each script/module has a single responsibility
– Caching layer: prevents redundant API calls (idempotent fetch)
– Modular I/O: data stores (Excel, shapefiles, JSON caches, HTML, geojson) treated as isolated components
D. Key technologies & libraries
– Python
– pandas, geopandas for data load/clean
– OSMnx + networkx for network fetch & metrics
– matplotlib/folium or built‑in OSMnx HTML export for visualizations
– shapely for geometry ops
– standard I/O: CSV, XLSX, geojson, HTML
• Blue rectangles for code modules