City Foundation Models for Learning General Purpose Representations from OpenStreetMap

Pasquale Balsebre, Weiming Huang, Gao Cong, Yi Li

TL;DR

CityFM is a self-supervised framework that builds "foundation models" for cities by training exclusively on OpenStreetMap (OSM) data. By using contrastive learning to align textual tags, building shapes, and road network relationships, it creates general-purpose representations that outperform specialized algorithms in tasks like traffic speed prediction, building classification, and population density estimation.

What Problem Does This Paper Address?

While Foundation Models (like GPT for text or CLIP for images) have revolutionized AI, the geospatial domain has lagged behind. Urban data is notoriously messy and "heterogeneous": it consists of points (POIs), polylines (roads), and polygons (buildings), each with different modalities like spatial coordinates, visual shapes, and inconsistent textual tags.

Existing geospatial models are usually "task-specific"—one model for traffic, another for land use. These require massive amounts of labeled data and don't share knowledge well. Furthermore, while OpenStreetMap provides a wealth of data, it is often sparsely annotated; for instance, only about 20% of buildings in OSM have tags describing their function. CityFM aims to bridge this gap by learning a unified representation that can "fill in the blanks" using the inherent relationships between an object's shape, its location, and its neighbors.

Methods

The core of CityFM is a self-supervised pre-training framework that uses three distinct contrastive objectives to fuse different data modalities (see Figure 1).

Figure 1: CityFM’s self-supervised pre-training framework. The three contrastive objectives are highlighted: (1) Text-based objective; (2) Vision-Language multimodal objective; (3) Road-based objective. Some dashed red lines are omitted for clarity.
  1. Text-based Contrastive Objective: This aligns an entity's textual tags (processed via BERT) with its spatial context. The model learns that entities appearing on the same road segment likely share semantic similarities (e.g., a "pharmacy" and a "doctor's office" often appear near each other).
  2. Vision-Language Multimodal Objective: This teaches the model to associate the physical shape and size of a building (processed via ResNet-18) with its functionality. Even if a building is untagged, the model can infer its use based on its geometry.
  3. Road-based Contrastive Objective: This is a novel addition that leverages OSM "Relations." By looking at public transport routes (like bus loops), the model identifies "arterial roads"—critical links that behave similarly in terms of traffic, regardless of their physical distance from one another.

For location, the authors argue that complex learned encoders are unnecessary. Instead, they use a Sinusoidal Location Encoder (similar to the positional encodings in Transformers) to project latitude and longitude into high-dimensional space, allowing the model to capture spatial relationships at multiple granularities.

Datasets

The models are pre-trained using raw OpenStreetMap (OSM) data for specific cities (Singapore, New York City, and Seattle). For evaluation, the authors used:

  • Traffic Speed: Uber Movement data (average speeds on road segments) for NYC and Seattle.
  • Building Functionality: The Singapore Government's land-use dataset, which provides ground-truth labels for over 64,000 buildings.
  • Population Density: Census-level population data for NYC and Singapore.

Key Insights and Ideas

  • Relations Matter: Most previous work ignored OSM "Relations" because they are structurally complex. CityFM shows that bus routes and train lines are powerful signals for identifying a road's functional importance in a city's hierarchy.
  • Geometry as a Proxy for Function: The model successfully learns that a building's footprint is a strong indicator of its use. As shown in Figure 2, the model can distinguish between a "house" (small, rectangular) and a "church" or "school" (larger, complex shapes) based on visual features alone.
  • Contextual "Emptiness": To handle road segments with no nearby POIs, the authors introduced an "empty node" token. This prevents the contrastive loss from failing when spatial context is sparse, a common issue in real-world map data.
Figure 2: Some examples demonstrating CityFM’s capability to associate the visual characteristics of OpenStreetMap’s polygons, with their corresponding functionality. We report the similarities of the shape and size with the textual encodings of the tags.

Key Results

CityFM consistently outperformed both general-purpose embeddings (like GeoVectors) and task-specific state-of-the-art models:

  • Traffic Speed: In NYC, CityFM achieved a Mean Absolute Error (MAE) of 3.2 mph, significantly better than the 3.78 mph achieved by IRN2Vec, a specialized road network model.
  • Building Classification: CityFM reached a 91.93% accuracy in classifying building types in Singapore, outperforming SpaBERT (75.95%) and even fine-tuned vision-only models.
  • Population Density: The model achieved an $R^2$ of 0.82 in Singapore, demonstrating that its entity-level embeddings aggregate effectively to represent entire urban regions.

Limitations and Future Work

The authors note that while the framework is general, the current models are pre-trained on a per-city basis. A truly "global" foundation model would likely need to account for regional differences in architectural styles and tagging conventions. Additionally, while OSM is the most complete open source, its quality varies globally; future work could explore integrating satellite imagery or human mobility data to further enrich the representations.

Summary updated

BibTeX
@inproceedings{balsebre2024city,
  author = {Pasquale Balsebre and Weiming Huang and Gao Cong and Yi Li},
  title = {{City Foundation Models for Learning General Purpose Representations from OpenStreetMap}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2024},
  doi = {10.1145/3627673.3679662},
}
Figure