Computer Science
Urbanity: automated modelling and analysis of multidimensional networks in cities
W. Yap, R. Stouffs, et al.
This paper introduces Urbanity, a Python package that revolutionizes urban network construction by integrating open data for enhanced location context. Conducted by Winston Yap, Rudi Stouffs, and Filip Biljecki, the research presents compelling evidence that adding contextual features significantly boosts the accuracy of urban machine-learning models.
~3 min • Beginner • English
Introduction
The paper addresses how to better represent and analyze the complexity of cities by enriching urban street networks with contextual and semantic information. While cities are understood as complex systems, most network studies emphasize structure and connectivity (metric/topological measures) and miss critical contextual dimensions. With richer urban data becoming available, the authors argue for analytical approaches that integrate location-specific features to overcome structural similarity among city networks and improve machine learning on graphs. However, existing comprehensive solutions (e.g., knowledge graphs, PSS, CIMs, Digital Twins) face adoption barriers due to computational and resource demands, limiting open and reproducible science. To address these gaps, the authors introduce Urbanity, a Python package that: (1) automatically builds urban networks at any scale worldwide; (2) augments nodes with diverse indicators (e.g., buildings, streetscapes, population, POIs); and (3) produces aggregate indicators for arbitrary geographic areas. The goal is to bridge computational tools with theory on cities as complex systems and support within- and cross-city analyses.
Literature Review
The paper reviews street-centric representations of urban networks—primal planar networks (nodes as intersections, edges as segments) and dual networks (nodes as segments, edges as contiguity). Both capture different facets of city structure and are commonly modeled as undirected, distance-weighted graphs, with possible extensions (directed edges, multi-typed nodes/edges). The authors survey urban network tools (e.g., OSMnx, Pandana, spaghetti, SANET, QNEAT3, Urban Network Analysis toolbox, cityseer, Place Syntax Tool, depthmapX, COINS). Most prioritize metric/topological indicators, wayfinding, accessibility, and clustering, with limited emphasis on contextual indicators (e.g., buildings, land use). Urbanity aims to extend this ecosystem by (1) providing a planner-friendly mapping interface for boundary specification; (2) integrating semantic and contextual indicators into networks for tasks such as multi-criteria site analysis and graph predictive modeling; and (3) enabling rapid benchmarking and comparative analyses through consistent extraction of aggregate indicators across geographies.
Methodology
Software and design: Urbanity is developed in Python, leveraging existing open-source packages. It offers an object-oriented, planner-oriented workflow, including an interactive mapping interface to define areas of interest via drawing or shapefile upload. Outputs include a NetworkX graph plus relational node and edge attribute tables.
Data acquisition: Datasets are selected based on (1) global coverage, (2) spatial granularity, and (3) open access. Core sources include OpenStreetMap (streets, buildings, POIs), Mapillary (crowdsourced street-view imagery), and Meta’s high-resolution population density maps. Proprietary datasets (e.g., Google Street View, WorldPop) were excluded to maintain openness and comparability across cities.
Contextual feature extraction: Urbanity’s network extraction API compiles metric/topological measures and appends contextual features such as building morphology, population, POIs, and SVI-derived indicators. Geographic projections are handled automatically based on location. For aggregate statistics (e.g., total population, building footprint share) over arbitrary polygons, Urbanity provides fast summarization functions.
Street-view imagery processing: Streetscape indicators are derived by semantic segmentation of Mapillary SVI using Mask2Former, a transformer-based model featuring masked attention and a multiscale decoder. Pretrained on the Mapillary Vistas dataset (65 classes), Mask2Former offers improved accuracy for diverse object scales with feasible computation. Processing was performed on an NVIDIA GeForce RTX 3090 GPU, taking ~3 days per city; results are precomputed for rapid querying.
Predictive experiment—road category classification: A transductive edge classification task is formulated per city to predict OSM-based hierarchical road classes (1: national; 2: regional; 3: precinct; 4: neighbourhood; 5: local access). For each city, edges are split 80/20 into train/validation. Edge feature embeddings are constructed via a cross-attention approach that appends adjacent node features. Models are trained for 500 epochs with hidden dimension = 64 and learning rate = 0.01 using PyTorch Geometric. Architectures include GCN, GraphSAGE, and GAT. Feature ablations evaluate the contribution of: metric/topological features (M/T), buildings, population, POIs, and SVI, including experiments with different node buffer radii (100 m vs 200 m). Performance is reported as mean accuracy, and top models are further evaluated with one-vs-rest ROC/AUC curves.
Key Findings
- Descriptive cross-city differences: The Urbanity global dataset illustrates clear structural and contextual differences among five cities (Singapore, Paris, Bangkok, Chicago, Seattle). Bangkok has the highest total population (~9.8M) and the lowest building footprint share (~2.37%), suggestive of sprawl. Paris, Chicago, and Seattle have fewer nodes/edges than Bangkok but relatively high network densities, consistent with more intricate mobility networks. Singapore exhibits high population with relatively low building footprint and network density, yet very high population-to-built-up density (~68,000 persons/km² vs ~66,600 in Paris and ~20,600 in Chicago).
- Network assortativity of greenery (GVI): Singapore shows high and consistent assortativity, indicating balanced greenery between adjacent locations and reflecting long-standing greening policies. Bangkok displays sporadic greenery patterns with pockets of high assortativity aligning with green zone regulations, underscoring the importance of green zone protections for equitable access.
- Node density vs building complexity: Parisian subzones are highly homogeneous (consistent with centralized planning history). Singaporean subzones are most diverse, reflecting varied land-use needs of a city-state. Bangkok, Chicago, and Seattle exhibit a positive association between node density and mean building complexity; U.S. subzones have lower average building complexity (block morphology), with Chicago’s Magnificent Mile as a high-complexity outlier.
- Edge classification with GNNs: Adding contextual/semantic indicators consistently improves accuracy across cities and models. Largest gains observed in Paris (up to +11.7% mean accuracy) and Singapore (up to +7.9%), with Chicago, Seattle, and Bangkok improving by ~3–5%. GAT and GraphSAGE generally outperform GCN. Removing metric/topological features causes marked accuracy drops, highlighting the centrality of graph structure in current GNNs. Buffer radius sensitivity is city-dependent: smaller buffers boosted performance in Paris, Singapore, and Chicago but reduced it in Seattle and Bangkok, reinforcing the need for context-aware parameter tuning.
Discussion
Urban networks provide a powerful, multi-scalar lens on urban complexity, encompassing social, economic, and environmental functions beyond mere movement. The study advocates a broadened analytics paradigm that integrates contextual and semantic attributes with traditional network structure, aligning computational approaches with planning theory and practice. The authors call for: (1) reconciling quantitative network analyses with qualitative, bottom-up perspectives from urban studies; (2) moving beyond urban physicalism by linking diverse indicators to explore form–function dynamics; (3) careful, transparent, and accountable integration of GeoAI and ML to support equitable planning, acknowledging that optimization is not always the primary goal; and (4) standardized benchmarking datasets and practices for robust, comparable evaluations across cities. The findings emphasize that cities differ fundamentally in structure and context, necessitating comparative analyses and context-specific feature engineering and model tuning.
Conclusion
The authors present Urbanity, an open-source tool that automates the construction of feature-rich urban networks and demonstrates the value of contextual features for descriptive and predictive tasks across multiple cities. Empirical results show that contextual and semantic attributes enhance the expressiveness of urban network representations and improve GNN-based road classification performance. The work supports comparative urban studies and scalable urban ML modeling. Future work will expand contextual representations (e.g., pedestrian-scale attributes like sidewalk conditions and accessibility), enable data sharing and interoperability for collaborative enrichment, and explore dynamic, actor-based processes (e.g., reinforcement learning) to deepen understanding of emergent urban behaviors.
Limitations
- Data completeness and quality: Reliance on open datasets (OSM, Mapillary, Meta population maps) introduces variability in coverage and quality; classification performance issues in Bangkok likely reflect data quality limitations. Some critical pedestrian-scale attributes (e.g., sidewalk condition, barrier-free accessibility) are often missing from global datasets.
- Exclusion of proprietary datasets: To maintain openness and global comparability, proprietary datasets (e.g., Google Street View, WorldPop) were excluded, potentially limiting feature richness in some contexts.
- Model and parameter sensitivity: GNN performance is sensitive to the inclusion of metric/topological features and to context-specific parameters (e.g., node buffer radius), indicating no universal configuration across cities.
- Generalizability: Results are demonstrated on five global cities; while designed for scalability, broader validation across more diverse urban contexts and temporal dynamics remains for future work.
Related Publications
Explore these studies to deepen your understanding of the subject.

