Design a Geofence Lookup Service for Zones and Airports
Last updated: November 29, 2026
Quick Overview
Design the service that answers, for any coordinate, which operational polygons contain it (city, airport pickup zone, no-pickup area, surge zone, tax region), at the rate of every driver and rider location update.
Uber
November 29, 20260
0
0 solved
Design the service that answers, for any coordinate, which operational polygons contain it (city, airport pickup zone, no-pickup area, surge zone, tax region), at the rate of every driver and rider location update.
Nearly every Uber decision (pricing, regulations, airport queues, taxes) depends on which zones a point falls into, and Uber has written publicly about fast geofence lookups. Interviewers test spatial indexing, point-in-polygon cost, and how polygon edits roll out safely to a read-heavy fleet.
What the Interviewer Expects
- Use a spatial index (grid cells such as H3 or S2, or an R-tree) to prune candidates
- Run exact point-in-polygon only on the few candidates
- Precompute cells fully inside a polygon to skip exact checks
- Serve from in-memory replicas loaded from versioned snapshots
- Roll out polygon edits safely with validation
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you handle a point exactly on a polygon edge shared by two zones?
- An ops person draws a bad polygon covering a whole city as no-pickup. How do you catch that?
- What cell resolution would you choose and why?
- How do you also answer 'which zones did this trip route cross'?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Input: (lat, lng), optional zone type filter. Output: list of zone ids containing the point. Hundreds of thousands of polygons globally, some with thousands of vertices (airports, city borders). Query...
High-Level Design
- Zone authoring tool and store (Postgres with PostGIS) with review and validation.
- Snapshot builder: on change, builds an index artifact per region and publishes it with a version to object...