← Back to Projects

OpenStreetMaps

Built a directed, weighted graph from OpenStreetMaps JSON data using an adjacency list representation for routing and pathfinding

GraphsC++ParsingOpenStreetMaps

About This Project

This project focused on parsing real OpenStreetMaps JSON data and converting it into a fully functional graph structure used for routing computations. The implementation required extracting nodes and ways from structured geographic data, storing them as vertices and edges, calculating distances, and building an efficient adjacency list graph. This foundation supports shortest-path algorithms such as Dijkstra's for navigation applications.

Key Features

  • Parsed OSM JSON data using nlohmann::json to extract locations and road segments
  • Built a directed, weighted graph using adjacency lists
  • Stored geospatial coordinates and computed edge weights using geographic distance formulas
  • Added support for vertex and edge creation, lookup, and direct neighbor traversal
  • Validated graph integrity and ensured correct one-way and two-way road handling
  • Set up a structure ready for shortest-path algorithms like Dijkstra’s

Technologies Used

  • IDE: VSCode
  • C++
  • JSON Parsing

Challenges & Learnings

Challenges:

The most difficult aspect was converting OSM data into a clean graph representation. Handling one-way roads, assigning correct edge weights, and ensuring that all node references were mapped properly required a lot of debuggin. Additionally, dealing with real-world imperfect data introduced cases that needed error checking.

What I Learned:

This project strengthened my understanding of graph structures and adjacency lists. I learned how to parse real-world datasets, create reliabe graph abstractions, and prepare data structures for routing algorithms used in navagation systems.

This project was created in May 2025