Skip to content

Initial version of Google Maps Design#20

Merged
SweetCodey merged 4 commits intomainfrom
map-service
Mar 10, 2026
Merged

Initial version of Google Maps Design#20
SweetCodey merged 4 commits intomainfrom
map-service

Conversation

@ganeshkumarm1
Copy link
Collaborator

  1. Completed Intro, Requirements, Rendering, and Routing sections
  2. To work on Search and Dive Deep Insights
  3. Added TK place holder for sections that has to be updated

1. Completed Intro, Requirements, Rendering, and Routing sections
2. To work on Search and Dive Deep Insights
3. Added TK place holder for sections that has to be updated
* **Low Latency** – Search, tile loading, and routing responses must be with in 100 ms.
* **High Availability** – Core features should remain 99.99% during peak usage.
* **Scalability** – System must handle millions of concurrent users.
* **Geospatial Accuracy** – Location tracking and routing must be precise with an acceptable error of + or - 100 meters.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100m might be a lot of distance. Can we reduce it to 40m?


---

## API Design
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an explanation about why we use protobuf here? One to two line explanation is also fine.


The response will be binary data (pbf - Protocolbuffer Binary Format) containing layers such as roads, buildings, water, and places. Since it is binary, we cannot visualize the response. But after decoding, it looks something like below:

```json
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm failing to understand the response in simple language. Could it be possible to explain it a bit? 2-3 lines explanation is also fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. will ad it


### Routing

Routing finds the fastest possible route from source to destination and provides turn by turn instructions to reach the destination. This is the core "Point A to Point B" service. It uses algorithms on the static road graph to return a polyline (a compressed string of coordinates).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify the language here? Especially 3rd line seems to be rather complex.


**HTTP Response**

The response contains an array consisting of multiple routes sorted in the order of durationSeconds (ETA) ascending.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The response still seems confusing. Can you explain in one to two more lines?

```

## High Level Design
Below are some of the terms we frequently come across in the upcoming sections of the document.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add images or diagrams for each of the below? Even small images or diagrams are fine.


Because this work happens ahead of time, opening the map does not require image processing. The client simply requests the tiles needed for the current viewport.

![](Resources/HLD_Rendering_Capture.png)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't understand much from this image and the above steps. Can you try relating those steps to this image? That could help in better understanding.


![](Resources/HLD_Rendering_Vector.png)

Vector geometry is typically stored in spatial databases such as PostgreSQL with the PostGIS extension. During preprocessing, this geometry is organized into vector tiles, where each tile contains only the features that intersect that region and zoom level. These tiles are stored in object storage and served through CDNs, making them highly cacheable and efficient to distribute.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't understand this part: 'PostgreSQL with the PostGIS extension'


#### End-to-End Rendering Flow

![](Resources/HLD_Rendering_Flow.png)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have two API gateways?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. It is not needed. Will fix it


---

## API Design
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requirements had "Real-time Navigation i.e. continuously track user location and re-route." HLD also describes GPS updates every few seconds. But no API is defined for this. Can you work on adding it?

---

## API Design
### Search
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we paginate? Might be needed as we might get 100s of results for search.

* **Route Calculation** – Compute a path between source and destination.
* **Real-time Navigation** – Continuously track user location and re-route if needed.

### Non-Functional Requirements
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each NFR states a number but doesn't explain why it matters for a maps system specifically. Can we add one sentence per NFR explaining the consequence? E.g., "If tiles load slowly, the map feels laggy when users pan or zoom."


![](Resources/HLD_Search.png)

1. User enters a query (e.g., "coffee shops") and the client sends a `GET /v1/places/search` request with query text, and user's GPS location
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPS coordinates are sensitive PII. Consider a brief note about encryption in transit and retention policies.

#### 1. How does the system translate text into geographic coordinates
When a user searches for a specific location (for example **"Marina Beach"**), the system needs to convert that text into geographic coordinates. This process is called **Forward Geocoding**. Forward geocoding simply means converting human-readable text into **latitude and longitude**. For example, *"Marina Beach"* is translated into "13.0500° N, 80.2824° E"

> Similar to Forward Geocoding, there exists **Reverse Geocoing** where user taps a location on a map and get the place details.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "Reverse Geocoing" → "Reverse Geocoding" (typo)


**A\* (A-Star)**

Assume you are driving from Chennai Airport to Marina Beach. The road network includes small residential streets, arterial roads, and highways. If we ran Dijsktra, it would expand in all directions even though Marina Beach lies northeast of the airport.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "Dijsktra" is misspelled. It should be "Dijkstra". More such typos are there


**Contraction Hierarchies**

Assume another scenario, where you are driving from Chennai to Bengaluru. The road netwrok includes thousands of local streets, city arterial roads, and national highways. In reality, long-distance travel looks like: `local road → city arterial → National highway → city arterial → local road`. So, you do not evaluate every residential street between the two cities.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "road netwrok" → "road network". More such typos are there


#### 3. How does navigation adjust in real time

Consider a scenario where you are driving from Chennai Airport to T Nagar during evening traffic. The initial route is `Airport → GST Road → Kathipara → Anna Salai → T Nagar` and the estimated time is **40 mins**. While you drive, your phone sends location updates every few seconds via GPS (Global Positioning System). Each update contains atitude, longitude, speed, and direction.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "atitude" → "latitude"

@SweetCodey SweetCodey merged commit 335c85b into main Mar 10, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants