Skip to main content
4 min read
GeoAI · Intermediate ·

Graph Neural Networks for Spatial Analysis

Graph neural networks (GNNs) are a class of deep learning model designed for graph-structured data. In spatial analysis, they learn representations of places, roads, and regions by propagating information across geographic adjacency graphs.

A graph neural network (GNN) is a deep learning architecture that operates directly on graph-structured data, learning representations of nodes (entities) and edges (relationships) by iteratively aggregating information from a node’s neighbourhood. In spatial analysis, GNNs have become a dominant tool because geographic data is inherently graph-like — road networks, spatial adjacency, and administrative hierarchies are all graphs.

Why Graphs Fit Geographic Data

Traditional deep learning architectures (CNNs, transformers) assume inputs on regular grids or sequences. Geographic reality is irregular:

  • A road network is a directed graph where nodes are intersections and edges are road segments
  • Urban neighbourhoods form a spatial adjacency graph where each area is connected to its physical neighbours
  • Points of interest cluster around service areas defined by walkable catchments, not grid squares
  • OpenStreetMap itself is natively a graph: nodes, ways (sequences of nodes), and relations (groupings of ways)

GNNs operate natively on this structure, making them a natural fit for spatial ML.

How Spatial GNNs Work

A GNN layer performs neighbourhood aggregation: for each node, it collects feature vectors from adjacent nodes, applies a learnable transformation, and combines them to produce an updated representation. Stacking multiple layers allows information to propagate across the graph — a node in layer 3 has implicitly “seen” nodes up to 3 hops away.

Formally, for node v with neighbours N(v):

h_v^(l+1) = σ( W · AGGREGATE({ h_u^(l) : u ∈ N(v) ∪ {v} }) )

Where h_v^(l) is the node representation at layer l, W is a learnable weight matrix, and σ is an activation function.

Key GNN Variants for Spatial Work

Graph Convolutional Networks (GCN) — the baseline; each node averages its neighbours’ features. Simple but powerful for learning regional embeddings from OSM attributes.

Graph Attention Networks (GAT) — uses attention weights to selectively emphasise more relevant neighbours. Useful when spatial relationships are heterogeneous (e.g., a node adjacent to a park is more influenced by it than by a back alley).

GraphSAGE — samples a fixed-size neighbourhood at each layer, enabling inductive learning on graphs that weren’t seen during training. Important for applying urban models to new cities.

Heterogeneous GNNs — handle graphs with multiple node and edge types. In an OSM graph, buildings, roads, POIs, and land-use polygons are all distinct types with different feature spaces.

Spatial Applications

  • Urban characterisation — learning neighbourhood embeddings that capture safety, vitality, and land use from street-level features, without manual labelling
  • Traffic forecasting — propagating flow information across road network graphs for short-horizon prediction
  • Earthquake damage assessment — modelling physical interdependencies between buildings in a block
  • Disease spread — modelling mobility patterns as flows on commuting graphs

Challenges

Scalability — full-city road networks have millions of nodes. Mini-batching on graphs is non-trivial because neighbourhood sampling cuts the graph, potentially losing long-range spatial dependencies.

Heterophily — spatial GNNs often assume similar nodes are connected (homophily). But adjacent land uses are often dissimilar (residential next to industrial), which breaks standard aggregation assumptions.

Dynamic graphs — cities change. A GNN trained on a static snapshot of OSM may degrade as the graph evolves.

MORPHEME: GNN-Based Urban AI

My research project MORPHEME uses spatial GNNs to learn urban embeddings across 24 global cities. The model treats each city as an H3 cell graph — nodes are hexagonal grid cells, edges encode spatial adjacency and distance — and learns self-supervised representations of urban character from raw OSM feature distributions.

The goal: a single model that can quantify vibrancy, safety, and function for any city on Earth, without labelled training data or city-specific fine-tuning. See the full SAWiP research programme for broader context, and WalkGrid for a related application of spatial GNNs to active travel routing.

Last updated 24 April 2026

Explore Further

Related Blog Posts