Choosing a spatial index
medium 4 minStart with the query and update pattern.
Video lesson · Chapter 1 of 5
Three maps need different guarantees
The city dashboard and the dispatcher need different indexes
1:16Reel
Theory
Read or listen first. About 1 min.
What it is
The right geographic index depends on the question. A reporting query assigns locations to buckets. A proximity query compares locations with a moving point and distance threshold.
One set of locations, two different questions
Why it exists
One crossing of a zone edge can change a bucket ID while hardly changing travel distance. Testing points near boundaries reveals whether a design answers the intended question.
Words to know
- Candidate set
- The locations selected by the index for a later exact check.
How it works
Step through the idea, or press Play.
Describe the query. A dashboard counts trips while dispatch needs nearby drivers.
Understand it
Worked example
Choosing a spatial index in practice
Compare a dashboard counting trips per cell with a dispatcher looking for every driver within 800 metres. The dashboard needs repeatable buckets; the dispatcher needs boundary recall and fresh positions.
Related case
Find every charger across a cell boundary
A driver near the edge of a grid cell requests chargers within 800 metres. The closest charger sits across the street in another cell.
Fetch intersecting cells and check candidates.