Building roadgraph-router-v2: from a practical mapping problem to a lightweight, browser-based routing engine.
Sometimes, the best way to understand a technology is to build something that depends on it.
That's how roadgraph-router-v2 started.
I was developing Energy&Fuel , a web application for exploring electric vehicle charging stations and fuel stations across Portugal.
The idea was relatively straightforward: bring together information about EV charging infrastructure, fuel prices, and station locations in one interactive map.
But as the project evolved, I wanted to go beyond displaying markers.
I wanted users to calculate actual road routes, compare alternatives, and understand how to reach a particular station.
That led me to an interesting problem:
Could I implement routing directly in the browser without relying on an external routing API?
The result was roadgraph-router-v2 , an open-source TypeScript routing engine built around OpenStreetMap data, compact road graphs, and A*…