Module 2 — Data: turning the world into information
Lesson 6 of 13
Spatial data
Everything happens somewhere.
A temperature measurement belongs to a location.
A house occupies a particular piece of land.
A vehicle moves through a road network.
Electricity is generated and consumed at particular points on a grid.
A hospital serves people distributed across an area.
A photograph records objects positioned relative to one another.
When location, distance, direction or spatial relationships form part of the information, we are working with spatial data.
Just as time-series data asks:
When did something happen?
spatial data asks:
Where did it happen?
And very often, knowing where changes what the data means.
Location is information
Suppose we record:
Temperature = 18°C
That tells us something.
But now compare:
Temperature = 18°C in Dublin
with:
Temperature = 18°C in Dubai
The numerical observation is identical.
Its meaning in context is very different.
Likewise:
House price = €500,000
means something different depending on whether the house is located:
- in a city centre,
- beside a railway station,
- in a rural area,
- beside the sea,
- close to a major employment centre.
Location is often not merely metadata attached to an observation.
It can be one of the variables that explains the observation.
What is spatial data?
Spatial data describes:
- where something is,
- where something happened,
- the shape of something,
- the distance between things,
- the direction from one thing to another,
- which things are nearby,
- which things are connected.
Examples include:
- GPS coordinates,
- addresses,
- postcodes,
- administrative regions,
- road networks,
- electricity networks,
- satellite imagery,
- maps,
- building footprints,
- land-use areas.
Spatial data allows us to represent the organisation of the world across space.
Points
The simplest spatial representation is a point.
A point represents a location.
For example:
latitude = 53.3498
longitude = -6.2603
might identify a location in Dublin.
Points can represent:
- homes,
- hospitals,
- weather stations,
- charging stations,
- shops,
- accidents,
- sensors,
- vehicles.
A dataset might look like:
| Sensor | Latitude | Longitude | Temperature |
|---|---|---|---|
| A | 53.35 | -6.26 | 18.2°C |
| B | 53.34 | -6.22 | 19.1°C |
| C | 53.37 | -6.29 | 17.8°C |
Now the measurements have a spatial structure.
Lines
Some things are better represented as lines.
Examples include:
- roads,
- railway lines,
- rivers,
- pipelines,
- electricity lines,
- fibre-optic cables.
A line describes a path or connection through space.
This matters because many systems do not operate according to simple straight-line distance.
A car cannot necessarily travel directly from one point to another.
It must follow roads.
Electricity flows through a network of connected lines.
Data travels through communication networks.
So sometimes the important question is not:
How close are these two locations?
but:
How are these locations connected?
Areas
Spatial data can also describe areas or regions.
Examples include:
- countries,
- counties,
- electoral districts,
- postcodes,
- school catchments,
- electricity network zones,
- land parcels.
An area contains many possible locations.
Instead of recording an exact coordinate, we might record:
County = Dublin
or:
Region = Leinster
This simplifies the spatial representation.
But it also loses detail.
Location can be continuous or discrete
This connects to the previous lesson.
Location can be represented continuously using coordinates:
latitude = 53.3498
longitude = -6.2603
Or discretely using categories:
city = Dublin
country = Ireland
postcode area = D02
The underlying location is the same.
The representation is different.
Precise coordinates preserve more information.
Regions simplify the world into spatial categories.
Spatial aggregation
Suppose we have temperature sensors across a country.
Each sensor records a local temperature.
We could keep every observation separately.
Or we could calculate:
national average temperature = 14.2°C
The average may be useful.
But much of the spatial information has disappeared.
Perhaps:
- the west is 11°C,
- the east is 16°C,
- mountain regions are 7°C,
- cities are 18°C.
All of that variation can disappear into one number.
This is spatial aggregation.
Aggregation destroys information
Imagine two regions.
Region A
Every location has approximately:
20°C
Region B
Half the locations are:
10°C
and half are:
30°C
Both regions have the same average:
20°C
But they describe very different spatial realities.
The average alone cannot tell us how the values are distributed across space.
Spatial aggregation can make very different systems appear identical.
This is why location often needs to be preserved.
National averages can hide local problems
Suppose a country has enough electricity generation overall.
At the national level:
Supply = 50 GW
Demand = 45 GW
It appears that there is plenty of electricity.
But perhaps most generation is located in the north while demand is concentrated in the south.
If the network between them can carry only:
5 GW
then some locations may still experience scarcity.
National balance does not guarantee local feasibility.
This illustrates a fundamental systems principle:
A resource can be abundant globally and scarce locally.
Spatial structure determines whether resources can actually reach the places where they are needed.
The same applies to many resources
Consider healthcare.
A country might have enough doctors per person nationally.
But if doctors are concentrated in cities, rural areas may still have poor access.
Or housing.
A country might have many empty homes while experiencing severe shortages in particular cities.
Or water.
A country might receive large amounts of rainfall overall while particular regions experience drought.
Or computing infrastructure.
There may be enormous computing capacity globally, but latency, network connectivity and regulation can make location important.
Scarcity is often spatial.
Distance matters
One of the simplest spatial relationships is distance.
Suppose we want to predict house prices.
Distance to:
- a city centre,
- a railway station,
- a school,
- a park,
- an airport
may be informative.
Instead of using raw coordinates, we might create features such as:
distance_to_station = 0.7 km
distance_to_city_centre = 4.2 km
These derived spatial features may help a model understand the relationship between location and value.
But distance is not always straight-line distance
Suppose two houses are physically 500 metres apart.
A river lies between them.
The nearest bridge is three kilometres away.
Straight-line distance:
0.5 km
Travel distance:
3+ km
Which distance matters?
That depends on the problem.
Spatial relationships can be measured using:
- straight-line distance,
- road distance,
- travel time,
- network distance,
- walking distance.
The appropriate definition depends on what we are trying to understand.
Travel time may matter more than distance
Suppose two homes are both:
10 km
from a city centre.
One is beside a fast railway line.
The other is connected by congested roads.
Their physical distance is the same.
Their accessibility is not.
For many services, the relevant spatial variable may therefore be:
time to reach something
rather than:
distance from something.
Spatial modelling often involves accessibility as much as geometry.
Neighbourhood matters
Things that are close together often influence one another.
House prices may resemble nearby house prices.
Air pollution at one sensor may resemble pollution nearby.
Weather conditions at neighbouring locations may be related.
Traffic congestion on one road may affect surrounding roads.
This idea is known broadly as spatial dependence.
A simple intuition is:
Nearby things are often more related than distant things.
Not always.
But often enough that location becomes useful for prediction.
Spatial autocorrelation
Suppose house prices in one neighbourhood are high.
Nearby houses may also tend to be expensive.
This means values are not randomly distributed through space.
Similar values cluster together.
This is sometimes described as spatial autocorrelation.
Likewise, we might see clusters of:
- pollution,
- disease,
- rainfall,
- unemployment,
- electricity demand.
Recognising spatial clustering can help us understand patterns that would be invisible in a non-spatial dataset.
But neighbours depend on the system
What counts as a neighbour?
Geographically, two houses may be beside one another.
But in an electricity network they might be connected to different feeders.
Two data centres might be thousands of kilometres apart physically but closely connected through a high-capacity network.
Two people may live nearby but use entirely different transport routes.
Neighbourhood therefore depends on the structure of the problem.
Sometimes neighbourhood means:
physically nearby
Sometimes it means:
connected through a network
Networks are spatial structures
Many important systems are networks.
Examples include:
- roads,
- railways,
- electricity grids,
- water networks,
- communication networks,
- airline routes.
A network consists conceptually of:
nodes
and:
connections between nodes
For example:
A — B — C
Perhaps A and C are geographically close.
But if there is no direct connection, movement must pass through B.
Network structure therefore constrains how:
- people,
- energy,
- water,
- information,
- goods
can move through space.
Connectivity can matter more than proximity
Imagine three towns.
Town A is 10 km from Town B.
Town C is 20 km from Town B.
But A and B are separated by mountains while C and B have a direct motorway connection.
Town C may effectively be more accessible despite being physically further away.
Similarly, an electricity generator may be geographically close to demand but separated by a constrained part of the network.
Spatial relationships therefore depend not only on coordinates but on infrastructure.
Spatial constraints affect decisions
Suppose an ambulance service has:
- 10 ambulances,
- 5 stations,
- thousands of possible incidents.
The question is not merely:
Do we have enough ambulances?
It is also:
Where should they be?
An ambulance at the wrong location cannot instantly serve a patient elsewhere.
The same applies to:
- hospitals,
- fire stations,
- warehouses,
- buses,
- batteries,
- electricity generators,
- computing infrastructure.
Resource allocation is often simultaneously:
how much?
and:
where?
Spatial data and service design
Consider a public transport service.
Demand varies across:
time
and:
space.
At 08:00, many people may want to travel:
suburbs → city centre
At 18:00, the direction may reverse:
city centre → suburbs
A good service therefore needs to understand:
where demand is
and:
when demand occurs.
This gives us a richer representation:
DEMAND = f(time, space)
Many real service-design problems have this structure.
Time and space belong together
Events happen at both:
a time
and:
a place.
Consider electricity demand.
We might represent it as:
Demand(location, time)
For example:
Demand(Dublin, 18:00)
is different from:
Demand(Cork, 18:00)
and different from:
Demand(Dublin, 03:00).
This creates spatiotemporal data.
Much of the world's most useful data is simultaneously spatial and temporal.
Weather is spatiotemporal
Weather changes:
- through time,
- across space.
A weather model might estimate:
temperature(x, y, t)
where:
- x represents one spatial dimension,
- y represents another,
- t represents time.
The model is therefore trying to understand a field evolving across space and time.
Weather forecasting is not simply:
What happens next?
It is:
What happens next, where?
Traffic is spatiotemporal too
Traffic conditions evolve across road networks.
Congestion at one location can propagate elsewhere.
A road accident at:
Location A at 08:15
may cause congestion at:
Location B at 08:30
and:
Location C at 08:45.
The system evolves through both time and space.
A useful model must understand:
where congestion is
where it is moving
how quickly it is changing.
Electricity systems are spatiotemporal
Electricity is generated and consumed at particular locations and particular times.
Suppose there is:
surplus wind generation in Scotland
while:
demand is high in southern England.
Whether that wind can serve the demand depends on network capacity between those locations.
Likewise, a battery may be extremely valuable on one side of a constrained network and much less valuable somewhere else.
So electricity cannot always be understood as a single national quantity.
The system has geography.
And the geography has constraints.
Images are spatial data
Spatial reasoning is not limited to maps.
An image is also a spatial dataset.
Each pixel has a location:
(x, y)
and contains information such as:
- brightness,
- colour.
A photograph might therefore be represented conceptually as:
Pixel(x, y) → colour values
But the important information is not just the individual pixels.
It is their spatial relationships.
A collection of pixels may form:
- an edge,
- a face,
- a wheel,
- a pedestrian.
Modern computer vision models learn patterns distributed across space.
Position changes meaning in images
Imagine the same set of pixels randomly rearranged.
The colours would still be present.
But the image would become meaningless.
Why?
Because spatial arrangement carries structure.
A pair of eyes appears above a nose.
Wheels appear below a car body.
Letters appear in particular spatial relationships.
Just as order matters in a time series, arrangement matters in spatial data.
Language has a kind of spatial structure too
Language is primarily sequential rather than geographic.
But modern AI often represents words and concepts within abstract mathematical spaces.
Words or concepts with similar meanings may appear close together in an embedding space.
For example, representations associated with:
- dog,
- puppy,
- animal
may lie closer together than representations associated with:
- dog,
- taxation,
- galaxy.
This is not physical space.
It is a mathematical space.
But the same basic idea appears:
Relationships can be represented through distance and position.
We will explore embedding spaces later in the course.
Maps are models
A map is one of the clearest examples of the principle:
A model is a representation, not reality.
A map might show:
- roads,
- buildings,
- rivers.
But exclude:
- noise,
- air pollution,
- traffic,
- elevation,
- property ownership.
Another map of exactly the same place might show entirely different information.
A transport map emphasises connectivity.
A topographic map emphasises terrain.
An electricity network map emphasises electrical infrastructure.
There is no single complete map.
Each representation selects what matters for a particular purpose.
Coordinate systems are representations
Even geographic coordinates depend on a system for representing the Earth.
The planet is approximately three-dimensional and curved.
A computer screen or paper map is usually two-dimensional.
Transforming between them requires a map projection.
Different projections preserve different properties.
Some preserve:
- angles,
- areas,
- distances
better than others.
No flat representation perfectly preserves every property of a curved surface.
Again:
representation involves choices and trade-offs.
Spatial resolution matters
Suppose satellite data divides the Earth's surface into squares.
Each square might represent:
1 km × 1 km
Another dataset might use:
10 m × 10 m
The second dataset has much finer spatial resolution.
It may reveal:
- individual roads,
- buildings,
- small land-use changes.
The first may show only broad regional patterns.
Just as sampling frequency determines temporal detail, spatial resolution determines geographic detail.
Higher resolution has costs
More spatial detail often requires:
- more sensors,
- more storage,
- more computation,
- more bandwidth.
A global dataset at one-metre resolution is vastly larger than one at one-kilometre resolution.
So we face a trade-off:
more detail ↔ more resources
The appropriate resolution depends on the problem.
Aggregation can create misleading conclusions
Suppose a city is divided into two neighbourhoods.
Neighbourhood A has:
very high unemployment
Neighbourhood B has:
very low unemployment
Combine them into one region and the average may appear moderate.
The aggregate statistic is not false.
But it hides local inequality.
The same issue appears in:
- healthcare,
- education,
- pollution,
- income,
- crime,
- electricity reliability.
Spatial aggregation can erase the very patterns we need to understand.
Boundaries are human choices
Suppose we calculate statistics by postcode.
Would we obtain the same patterns if we instead grouped people by:
- electoral district,
- county,
- school catchment?
Not necessarily.
Changing the boundaries can change the apparent pattern.
This is an important spatial-data problem.
The physical world has not changed.
Only the way we grouped it has.
The Modifiable Areal Unit Problem
This phenomenon is often called the Modifiable Areal Unit Problem, or MAUP.
Results can change depending on:
- the size of the regions,
- where their boundaries are drawn.
Suppose we measure average income.
Small neighbourhoods may reveal sharp local differences.
Large administrative regions may smooth them away.
This means spatial conclusions can depend partly on the geographic units chosen for analysis.
Local versus global prediction
Suppose we build one model to predict house prices across an entire country.
It might learn general relationships such as:
larger house → higher price
But local markets may behave differently.
Distance to a railway station might be extremely important in one city and almost irrelevant in a rural area.
A global model attempts to learn relationships across the whole dataset.
A local model focuses on a particular place or neighbourhood.
Neither approach is always better.
The appropriate scale depends on the problem.
Global models can miss local structure
Suppose average electricity demand across a country is predictable.
But one neighbourhood contains:
- many electric vehicles,
- electric heating,
- rooftop solar,
- batteries.
Its demand pattern may differ substantially from the national average.
A national model may perform well overall while performing poorly in that particular area.
This matters when decisions are made locally.
Good average performance can hide geographic inequality
Imagine an AI service has:
95% accuracy nationally
That sounds excellent.
But suppose:
Region A → 99% accuracy
Region B → 72% accuracy
The national average hides a serious geographic difference.
This can happen if:
- some regions have less training data,
- sensors are poorer,
- infrastructure differs,
- behaviour differs,
- populations differ.
Model evaluation should therefore sometimes ask:
Where does the model work well?
not merely:
How well does it work overall?
Location can become a proxy
Spatial variables can also create fairness problems.
Suppose an algorithm is prohibited from using a protected characteristic.
But it uses:
postcode
Postcode may correlate with:
- income,
- ethnicity,
- education,
- housing conditions,
- access to services.
Location can therefore indirectly reveal information that was not explicitly supplied.
Removing one variable does not necessarily remove the information associated with it.
We will return to this in the module on AI, society, power and fairness.
Spatial datasets can inherit historical patterns
Cities and infrastructure have histories.
Where people live today may reflect:
- historical planning,
- industrial development,
- transport investment,
- housing policy,
- economic inequality,
- discrimination.
Spatial data can therefore encode historical structures.
A model may learn that particular locations are associated with particular outcomes.
But those relationships did not necessarily arise naturally.
They may be the result of decades or centuries of decisions.
Once again:
Historical data contains history.
Predictions can change spatial behaviour
Suppose a navigation system predicts congestion on Road A.
It sends drivers to Road B.
Road B becomes congested.
The prediction has altered the spatial distribution of traffic.
Or suppose an AI recommends particular neighbourhoods to homebuyers.
Those recommendations may influence future demand and prices.
Or a delivery platform positions drivers based on predicted demand.
Drivers move.
The spatial system changes.
Prediction becomes part of the process generating future spatial data.
Maps can create feedback loops
Consider a navigation platform.
It observes:
traffic across the road network
Then predicts:
future journey times
Then recommends:
routes
Drivers follow those recommendations.
The distribution of vehicles changes.
The system observes the new traffic.
So:
TRAFFIC
↓
DATA
↓
PREDICTION
↓
ROUTE DECISION
↓
DRIVER ACTION
↓
NEW TRAFFIC
The map is no longer simply describing the world.
It is participating in it.
This is a powerful example of a reflexive system.
Spatial prediction
Sometimes we want to predict values at locations where we have no observations.
Suppose we have pollution sensors at 100 points across a city.
We want to estimate pollution everywhere else.
We might use:
- nearby sensor readings,
- road locations,
- wind,
- traffic,
- industrial activity.
The model attempts to infer the spatial field between observations.
This is a common problem in:
- weather,
- environmental monitoring,
- geology,
- agriculture,
- epidemiology.
Space introduces uncertainty
Suppose the nearest weather station is 50 km away.
How representative is its measurement of your location?
Perhaps very representative.
Perhaps not.
The answer depends on:
- terrain,
- altitude,
- coastlines,
- local weather.
Uncertainty often increases as we move away from observed locations.
Spatial prediction therefore connects naturally to the next module on probability and uncertainty.
Time and space together
We can now extend the course's recurring framework.
Previously:
PAST → DATA → MODEL → PREDICTION → DECISION → ACTION → FUTURE
But events do not merely happen through time.
They happen somewhere.
So a richer view is:
PAST STATES ACROSS SPACE
↓
OBSERVATIONS
↓
DATA
↓
MODEL
↓
POSSIBLE FUTURE STATES ACROSS SPACE
↓
DECISION
↓
ACTION
↓
NEW SPATIOTEMPORAL REALITY
The future has both:
when
and:
where.
Intelligent systems need to understand both
Consider an autonomous vehicle.
It must understand:
where am I now?
where are other objects?
how are they moving?
where might they be next?
The problem combines:
space + time + uncertainty
The same is true for:
- robots,
- drones,
- logistics,
- electricity networks,
- traffic management,
- weather forecasting.
Modern intelligent systems often need to reason about a world evolving across both time and space.
Ask spatial questions
Whenever location appears in a dataset, ask:
- Where was this measured?
- How precise is the location?
- What spatial resolution is being used?
- Have observations been aggregated?
- What information was lost through aggregation?
- What counts as a neighbour?
- Does straight-line distance make sense?
- Is network connectivity more important?
- Are there local patterns hidden by global averages?
- Are geographic boundaries influencing the result?
- Does the model perform differently in different places?
- Could location act as a proxy for other characteristics?
- Could predictions themselves change spatial behaviour?
These questions help reveal structure that may disappear when location is ignored.
The central idea
Spatial data tells us where things happen and how locations relate to one another.
That matters because:
location changes context
distance changes accessibility
networks constrain movement
local conditions can differ from global averages
aggregation can destroy information
A dataset that ignores space can make a system appear simpler than it really is.
Something can be abundant globally and scarce locally, accurate on average and inaccurate somewhere, or balanced in aggregate while infeasible in the places that actually matter.
Time tells us how a system evolves.
Space tells us how that system is distributed and connected.
Together they give us a much richer description of reality:
WHAT happened?
WHEN did it happen?
WHERE did it happen?
But not all data arrives as neat numerical measurements or rows in a table.
A photograph, a voice recording and a paragraph of text are data too.
In the next lesson, we will examine how images, sound and language become data that machines can process.