← udacity portfolio
cpp nd · control planning · February 2020

OpenStreetMap Route Planning (A*)

Hand-rolled A* over real OpenStreetMap road graphs in C++. The capstone of the C++ nanodegree's foundations module.

What it did

Load a real OpenStreetMap .osm extract (a neighborhood-sized chunk of road network) and find the shortest path between two clicked points. A* with a Euclidean heuristic, implemented from first principles in modern C++.

The pipeline

  1. Parse .osm XML → graph of nodes (intersections) + edges (road segments with distance + road class).
  2. Build adjacency list.
  3. A* with g(n) = distance-so-far, h(n) = Euclidean distance to goal, f(n) = g + h.
  4. Render the source map + the path overlay via io2d.

What was actually tricky

What I’d do differently with hindsight

What it taught me

Two things. First, classical graph search is still the right answer for most “shortest X” problems — fancy ML approaches add a lot of weight for usually-marginal returns. Second, modern C++ (the project required C++17) is fine — the language reputation is worse than the experience, especially with a graph library and <algorithm> on hand.


Source archive: Shivam-Bhardwaj/OpenStreetMap-Route-Planning (archived)
Writeup last touched: 2026-05-22