Google started project Google Maps in 2005. As of March 2021, Google Maps had one billion daily active users, 99% coverage of the world.
Although Google Maps is a very complex system, we can break it down into 3 high-level components. In this post, letโs take a look at how to design a simplified Google Maps.
๐๐จ๐๐๐ญ๐ข๐จ๐ง ๐๐๐ซ๐ฏ๐ข๐๐
The location service is responsible for recording a userโs location update. The Google Map clients send location updates every few seconds. The user location data is used in many cases:
-ย detect new and recently closed roads.
- improve the accuracy of the map over time.
- used as an input for live traffic data.
Map Rendering
The worldโs map is projected into a huge 2D map image. It is broken down into small image blocks called โtilesโ (see below). The tiles are static. They donโt change very often. An efficient way to serve static tile files is with a CDN backed by cloud storage like S3. The users can load the necessary tiles to compose a map from nearby CDN.ย
What if a user is zooming and panning the map viewpoint on the client to explore their surroundings?
An efficient way is to pre-calculate the map blocks with different zoom levels and load the images when needed.
Navigation Service
This component is responsible for finding a reasonably fast route from point A to point B. It calls two services to help with the path calculation:
1๏ธโฃ Geocoding Service: resolve the given address to a latitude/longitude pair.
2๏ธโฃ Route Planner Service: this service does three things in sequence:
ย ย ย ย - Calculate top-K shortest paths between A and B
ย ย ย ย - Calculate the estimation of time for each path based on current traffic and historical data
ย ย ย ย - Rank the paths by time predictions and user filtering. For example, the user doesnโt want to avoid tolls.
If you enjoyed this post, you might like our system design interview books as well.
SDI-vol1: https://amzn.to/3tK0qQn
SDI-vol2: https://amzn.to/37ZisW9
super simplified version