City Foundation Models for Learning General Purpose Representations from OpenStreetMap

Pasquale Balsebre, Weiming Huang, Gao Cong, Yi Li · DOI

Abstract

Pre-trained Foundation Models (PFMs) have ushered in a paradigm-shift in Artificial Intelligence, due to their ability to learn general-purpose representations that can be readily employed in a wide range of downstream tasks. While PFMs have been successfully adopted in various fields such as Natural Language Processing and Computer Vision, their capacity in handling geospatial data and answering urban questions remains limited. This can be attributed to the intrinsic heterogeneity of geospatial data, which encompasses different data types, including points, segments and regions, as well as multiple information modalities, such as a spatial position, visual characteristics and textual annotations. The proliferation of Volunteered Geographic Information initiatives, and the ever-increasing availability of open geospatial data sources, like OpenStreetMap, which is freely accessible globally, unveil a promising opportunity to bridge this gap. In this paper, we present CityFM, a self-supervised framework to train a foundation model within a selected geographical area of interest, such as a city. CityFM relies solely on open data from OSM, and produces multimodal representations of entities of different types, incorporating spatial, visual, and textual information. We analyse the entity representations generated using our foundation models from a qualitative perspective, and conduct quantitative experiments on road, building, and region-level downstream tasks. We compare its results to algorithms tailored specifically for the respective applications. In all the experiments, CityFM achieves performance superior to, or on par with, the baselines.

Introduction: The Challenge of Heterogeneous Geospatial Data

Geospatial data is notoriously "messy" and heterogeneous. Unlike natural language or images, a city is represented by a complex mix of points (Points of Interest or POIs), polylines (roads), and polygons (buildings). These entities are tied together by multimodal information, including GPS coordinates, visual shapes, and inconsistent, crowdsourced textual tags.

Historically, urban research has relied on "siloed" models—specialized architectures for traffic prediction, real estate valuation, or land-use classification—each requiring massive amounts of labeled data. Furthermore, many existing models ignore "Relations" (OpenStreetMap's way of grouping entities, such as bus routes) or discard the approximately 80% of buildings that lack descriptive tags. CityFM aims to bridge this gap by creating a Pre-trained Foundation Model (PFM) that learns general-purpose representations from raw, unlabeled map data.

Methodology: Multimodal Contrastive Learning

CityFM utilizes a self-supervised framework based on Mutual Information Maximization. It does not require human-labeled "ground truth" for pre-training; instead, it learns by identifying consistency across different views of the same data. The architecture revolves around three primary contrastive objectives:

  1. Text-based Contrastive Objective: Using a pre-trained BERT model, CityFM aligns the embeddings of entities that frequently co-occur in the same spatial context (e.g., a "pharmacy" and a "clinic" on the same street).
  2. Vision-Language Multimodal Objective: To handle untagged buildings, the model learns to associate a building's visual shape and size (processed via ResNet-18) with its functional tags. This allows the model to infer a building's purpose solely from its footprint.
  3. Road-based Context Objective: The model leverages OSM "Relations" (like bus loops) to identify arterial roads. It aligns the embeddings of road segments with similar "transportation weights," capturing the functional hierarchy of a city's network.
CityFM's self-supervised framework utilizing three contrastive learning objectives to align multimodal geospatial data.

For spatial positioning, the authors employ a sinusoidal location encoder similar to the original Transformer's positional encoding, but with a rescaling factor to handle the subtle differences in latitude and longitude coordinates.

Experimental Setup and Datasets

The model was pre-trained and evaluated using data from three major cities: Singapore, New York City (NYC), and Seattle. Pre-training relied exclusively on OpenStreetMap (OSM) data (Nodes, Ways, and Relations). Downstream evaluation utilized several high-quality datasets:

  • Traffic Speed: Uber Movement data (average taxi speeds mapped to OSM segments).
  • Building Functionality: Singapore Urban Redevelopment Authority (URA) data, covering ~64,000 polygons across 8 land-use classes.
  • Population Density: Official census-level density data for NYC and Singapore.

Results and Key Insights

CityFM consistently outperformed or matched state-of-the-art (SOTA) task-specific baselines across all domains. In NYC, CityFM achieved a Mean Absolute Error (MAE) of 3.2 mph for traffic speed inference, significantly better than the 3.78 mph achieved by IRN2Vec, a specialized road network model. For building classification, CityFM reached an accuracy of 91.93%, outperforming multimodal baselines like CLIP (74.98%) and SpaBERT (75.95%).

Form Follows Function

A core insight of the research is that building geometry serves as a powerful proxy for land use. By training on the 20% of buildings that are tagged, CityFM learns to represent the 80% that are not, simply by analyzing their shape and size.

Visualization of how CityFM uses building geometry (shape and size) to predict functional categories.

The Power of Spatial Context

Standard language models often over-rely on word similarity (e.g., "amenity: hospital" and "amenity: cafe" look similar because of the shared word "amenity"). CityFM’s contrastive pre-training forces the model to prioritize spatial co-occurrence, correctly identifying that a "pharmacy" is more semantically related to a "hospital" within an urban context. Furthermore, the model demonstrates that OSM "Relations," such as bus routes, are valuable "free" signals that help identify critical urban infrastructure without needing expensive sensor data.

Conclusion and Future Work

While CityFM represents a significant advancement, several challenges remain. The model's performance is currently tied to the quality of OSM data; in regions where mapping is sparse, the context for contrastive learning may be insufficient. Future research will explore cross-city transferability—determining if a model trained on NYC can understand the layout of London or Tokyo—and the incorporation of temporal dynamics to capture how cities evolve over time.

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