0%
System requirements
Functional
Capacity estimation
Traffic
API design
Tile Retrieval
Database design
PostGIS Schema
High-level design
Request flows
Detailed component design
GATE: Tile Pyramid and Pre-Generation
Trade-offs and tech choices
Pre-Generated Tiles vs On-Demand Rendering
Failure scenarios and bottlenecks
CDN Outage
Future improvements
Vector Tiles
ML-Based Image Enhancement
System requirements
Functional
Capacity estimation
Traffic
API design
Tile Retrieval
Database design
PostGIS Schema
High-level design
Request flows
Detailed component design
GATE: Tile Pyramid and Pre-Generation
Trade-offs and tech choices
Pre-Generated Tiles vs On-Demand Rendering
Failure scenarios and bottlenecks
CDN Outage
Future improvements
Vector Tiles
ML-Based Image Enhancement
A geospatial image serving system powers every map you have ever used. When you pan Google Maps or zoom into a satellite view, you are loading dozens of small image tiles stitched together by the browser. The system behind this must store massive volumes of satellite and aerial imagery, slice them into tiles, and serve the right tiles instantly as the user navigates.
The scale of geospatial data is staggering. Google Maps alone serves trillions of tile requests per year across billions of devices. A single Landsat satellite captures roughly 700 scenes per day, each covering 185 by 185 kilometers at 30-meter resolution. Commercial constellations like Planet Labs photograph the entire Earth daily. The challenge is not just storing this data but making any piece of it retrievable in under 200 milliseconds for any user on the planet. This is fundamentally a read-heavy, latency-sensitive system where the data is addressed by geographic coordinates rather than arbitrary keys.
Start with user volume and work down to tile request rates. The key metric is tiles per second because that drives CDN sizing and origin capacity.
The API has two distinct surfaces: a high-throughput read path for tile serving and a low-throughput write path for image upload. The read path must be CDN-cacheable and stateless. The write path must be authenticated and idempotent.
Why two surfaces? Because the read path and write path have fundamentally different characteristics that affect API design. The read path serves 200 million requests per day, must be cacheable, and requires no authentication for public tiles. The write path handles maybe 1,000 requests per day, requires authentication (you need to know who uploaded what), and triggers background processing. Designing a single unified API for both would force compromise: either the read path carries unnecessary authentication overhead, or the write path lacks proper access control.
The data layer has three components serving different access patterns: PostGIS for spatial metadata, S3 for image and tile storage, and Redis for caching hot metadata.
Why three separate storage technologies? Because the system has three fundamentally different data types with different access patterns. Spatial metadata (image bounds, capture dates) needs indexed spatial queries and transactional writes: that is what PostGIS is built for. Tile binary data needs high-throughput reads of static files with CDN integration: that is what S3 is built for. Hot query results need sub-millisecond reads from memory: that is what Redis is built for. Using a single database for all three would mean PostgreSQL storing 30TB of tile binaries (terrible for performance and cost) or S3 handling spatial intersection queries (impossible). Each storage technology handles the workload it was designed for.
The architecture separates the read path (tile serving) from the write path (image upload and tiling). The read path must be fast and handle massive concurrent load. The write path must be reliable and handle heavy computation. Mixing them would force a single system to optimize for conflicting requirements.
Think of it this way: the read path is like a library where millions of people check out books simultaneously. The books are already on the shelves (tiles in S3) and the librarian (Tile Service) just needs to find and hand them over quickly. The write path is like the publishing house that creates new books. It receives manuscripts (raw images), edits and typesets them (tiling and compression), and places finished books on the library shelves. The publishing house can work slowly and carefully; the library must serve patrons instantly. Combining them into one building would mean noisy printing presses next to quiet reading rooms.
Two primary flows define the system: image upload (write path) and tile retrieval (read path). The write path happens infrequently but involves heavy computation. The read path happens constantly and must be fast.
Understanding these flows end-to-end is critical for interviews because each step reveals a design decision. The upload flow shows why asynchronous processing matters, why message queues provide fault tolerance, and why S3 writes happen before queue publishing. The retrieval flow shows why CDN caching is transformative, why the Tile Service is stateless, and why the database is not on the hot path. Walking through these flows with concrete latency numbers demonstrates deep understanding of the system.
When explaining these flows in an interview, start with the tile retrieval flow (the read path) because it is the higher-volume, more latency-sensitive path and it establishes the architecture's core pattern: CDN-cached static file serving. Then explain the upload flow as the mechanism that populates those static files. This ordering mirrors how users experience the system: they view tiles first and might upload imagery later. Finally, mention the spatial search flow as the discovery mechanism that connects users to available imagery before they start loading tiles.
Mid-level: describe the tile pyramid concept and how tiles map to zoom levels.
Senior: explain the 4x growth math per zoom level, justify WebP over JPEG, and walk through R-tree spatial index traversal.
Staff: design the hybrid pre-generation and on-demand rendering strategy, calculate the storage-compute trade-off at each zoom level, and propose CDN cache invalidation for updated imagery.
Pre-generation produces static files that CDN can cache and serve without computation. This gives the lowest possible serving latency and simplest origin architecture. The trade-off is storage: each zoom level quadruples the tile count, and deep zoom levels for large datasets consume petabytes. On-demand rendering saves storage by generating tiles only when requested, but requires compute capacity proportional to request volume. The hybrid approach works best: pre-generate zoom levels 0 through 14 (manageable tile counts, high traffic) and render zoom levels 15+ on demand, caching results.
When discussing trade-offs in an interview, always attach concrete numbers. Do not say CDN reduces latency. Say CDN serves cache hits in 10-50ms versus 100-300ms from origin, and a 95 percent hit rate means the origin handles 575 requests per second instead of 11,500. Numbers make your trade-offs concrete and demonstrate system design depth.
If the CDN edge goes down, all tile traffic hits the origin directly. The immediate impact is latency degradation from 10-50ms to 100-300ms. The deeper risk is that the origin was sized for 5% of traffic (575 requests per second at peak) and now receives 100% (11,500 per second).
Instead of serving pre-rendered raster images, vector tiles deliver the raw geometric data (roads, building outlines, labels) as compact binary Protocol Buffer files. The client renders the map on the fly using GPU-accelerated libraries like MapLibre GL. This enables dynamic styling (dark mode, custom colors), smooth rotation and tilting, resolution-independent rendering on any screen density, and payloads roughly 10x smaller than raster tiles. The trade-off is client complexity: the browser needs WebGL support and more CPU/GPU resources for rendering. Vector tiles complement raster satellite imagery rather than replacing it — satellite photos are inherently raster data. The backend changes are modest since vector tiles follow the same z/x/y addressing and CDN caching model as raster tiles, just with a different generation pipeline and a Protocol Buffer format instead of image formats.
Reading a solution is not the same as producing one under interview pressure. Design it on the whiteboard and get scored feedback.
0%
System requirements
Functional
Capacity estimation
Traffic
API design
Tile Retrieval
Database design
PostGIS Schema
High-level design
Request flows
Detailed component design
GATE: Tile Pyramid and Pre-Generation
Trade-offs and tech choices
Pre-Generated Tiles vs On-Demand Rendering
Failure scenarios and bottlenecks
CDN Outage
Future improvements
Vector Tiles
ML-Based Image Enhancement
System requirements
Functional
Capacity estimation
Traffic
API design
Tile Retrieval
Database design
PostGIS Schema
High-level design
Request flows
Detailed component design
GATE: Tile Pyramid and Pre-Generation
Trade-offs and tech choices
Pre-Generated Tiles vs On-Demand Rendering
Failure scenarios and bottlenecks
CDN Outage
Future improvements
Vector Tiles
ML-Based Image Enhancement