# Road localisation in GrabMaps

[Grab](https://yomu.fyi/company/grab) · Roxana Crisan · Nov 17, 2023

**Type:** Problem & solution

## Summary

Grab needed to localise nearly 30 million road segments across more than 10,000 area boundaries in Southeast Asia to attach hyperlocal attributes like language, driving side, and vehicle access rules. Testing direct geometric inclusion between complex road polylines and boundary polygons proved computationally prohibitive for daily map generation pipelines. To optimize this process, Grab introduced geohashes as rectangular proxies, precomputing geohash coverage across borders and road segments before joining the datasets in parallel. To resolve misclassification errors near borders without sacrificing performance, the team evaluated geohash coverage percentages and refined boundary-touching geohashes with polygon clipping. A laptop benchmark on a subset of data reduced runtime from 38 minutes with geometric intersection to 78 seconds using the geohash approximation.

## Context

Grab needed to assign nearly 30 million road segments across Southeast Asia to over 10,000 geographic areas to add hyperlocal metadata while maintaining daily map delivery in a cost-effective manner, but exact polyline-in-polygon intersection checks were computationally expensive.

## Approach / What changed

Grab replaced precise geometric inclusion checks with geohash-based proxy approximations, precomputing geohash memberships for both border areas and road polylines to execute distributed data joins, while evaluating coverage percentages and cutting geohash boundaries near border edges to handle precision tradeoffs.

## Takeaways

- Replacing polyline-in-polygon intersections with geohash proxy joins reduced a sample dataset's execution time from 38 minutes to 78 seconds on a laptop benchmark.
- Roads located near border lines are susceptible to misclassification when using coarse geohashes because an entire cell is assigned to an area even if only a small fraction falls inside the boundary.
- A hybrid precision strategy applies simple geohash matching for cells fully enclosed by an area and limits computationally heavier border-shape cutting strictly to geohashes intersecting border boundaries.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [Data Pipelines](https://yomu.fyi/topic/data-pipelines), [Performance](https://yomu.fyi/topic/performance), [Scalability](https://yomu.fyi/topic/scalability)

[Read original post](https://engineering.grab.com/road-localisation-grabmaps)
