← All issues
Urban Function Inference via Spatial Graph Learning

Urban Function Inference via Spatial Graph Learning

· By Mansa Muhammad

The ability to predict urban functions from spatial structures is moving from theoretical research to practical, end-to-end pipelines. A new coding implementation using city2graph, OSMnx, and PyTorch Geometric demonstrates how to integrate geospatial data processing with Graph Neural Networks (GNNs) to infer the purpose of urban environments.

The workflow begins by collecting real urban Point of Interest (POI) data and street network information from OpenStreetMap. By using tools like c2g (city2graph), the process engineers spatial features and constructs multiple proximity graph families. This allows for a direct comparison of how different graph-building strategies represent the same urban environment. The pipeline further develops both heterogeneous and homogeneous graph structures, converting them into PyTorch Geometric format to train a GraphSAGE model.

This approach shifts the focus from simple data collection to structural representation. By training models to predict POI categories—such as food, retail, education, and health—directly from spatial structure, the methodology moves beyond static mapping. The implementation uses a specific coordinate, (35.6595, 139.7005), and a distance of 1100 meters to demonstrate the extraction of amenities like restaurants, schools, and hospitals.

For developers and urban planners, the significance lies in the automation of urban function inference. The integration of geospatial processing and GNN-based learning into a single workflow reduces the friction between raw OpenStreetMap data and actionable machine learning models. As urban environments become increasingly digitized, the ability to programmatically infer land use from graph-based spatial features will become a standard requirement for smart city infrastructure.

How will the ability to automate urban function inference change the way we approach large-scale city planning?

Subscribe to The Mansa Report

Strategic intelligence on AI, business building, and the future of technology. Delivered Monday through Friday.