Design a Reverse Geocoding Service From Coordinates to Addresses
Last updated: November 29, 2026
Quick Overview
Design an API that takes a latitude and longitude and returns the best street address and administrative areas (city, region, country), used by apps like Google Photos to label where a picture was taken.
0
0
0 solved
Design an API that takes a latitude and longitude and returns the best street address and administrative areas (city, region, country), used by apps like Google Photos to label where a picture was taken.
Reverse geocoding is a compact geo question that fits a screen. The interviewer checks spatial lookup of nearby address points and roads, point-in-polygon for administrative areas, and caching of a read-only dataset.
What the Interviewer Expects
- Look up nearest address points or road segments with a spatial index
- Use point-in-polygon on administrative boundaries for city and country
- Interpolate house numbers along road segments when needed
- Cache results by rounded coordinates
- Return confidence and handle oceans or remote areas
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 would you handle a point exactly on a border?
- How do you serve this when the address data updates weekly?
- What precision should the cache key use?
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 language. Output: formatted address, components, and accuracy level (rooftop, interpolated, approximate).
- Read-only dataset updated weekly. High QPS, p99 under 50 ms....
High-Level Design
Stateless service replicas load a read-only, sharded index built offline:
- Address points (rooftop locations) indexed by S2 cell.
- Road segments with house number ranges per side, indexed by...