Design Nearby Places Search Using S2 Cells for Google Maps

Last updated: November 29, 2026

Quick Overview

Design the backend for queries like "coffee near me" or "gas stations along this map view" that returns matching places within a radius or viewport, ranked, from a dataset of hundreds of millions of places.

Google
System Design
Software Engineer
Google
November 29, 2026
Software Engineer
System Design Round
System Design
Medium

0

0

0 solved


Design the backend for queries like "coffee near me" or "gas stations along this map view" that returns matching places within a radius or viewport, ranked, from a dataset of hundreds of millions of places.

Spatial indexing is central to Google Maps, and Google's own S2 library makes cell-based indexing a natural talking point. The interviewer checks how you index points, convert a circle or viewport into cell ranges, combine with text filters, and keep the index fresh.

What the Interviewer Expects
  • Choose a spatial index (S2 cells, geohash, quadtree) and justify it
  • Convert a radius or viewport into a cell covering
  • Combine spatial filtering with category or text match
  • Rank candidates by distance, relevance, and quality
  • Handle dense areas versus sparse rural areas
Key Topics to Cover
S2 geometry
cell covering
inverted index
geo sharding
ranking
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you pick the cell level for a query?
  • What changes for a query along a route instead of around a point?
  • How do you keep open-now status fresh?
  • How do you shard the index?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Query: location (or viewport), radius, optional category or text, open-now filter, result limit.
  • Hundreds of millions of places; updates (new place, hours change) visible within minutes.
  • p99 lat...
High-Level Design
  • Place store: place records with lat/lng, categories, hours, ratings.
  • Geo index: for each place, its S2 cell ID at a fixed fine level (for example level 16, around 150 m). Cell IDs are 64-b...

Submit Your Answer
Markdown supported