RhythmHacks Hackathon Project
Draw2Route converts a user-drawn line (a list of GPS points) into a realistic walking route that aligns with real-world roads.
It uses OpenStreetMap data through the OSMnx library to find the most accurate path that matches the shape of the drawing.
-
Input:
Takes a list of GPS coordinates (points) and a flag to optionally use the OpenStreetMap API. -
Bounding Box:
Builds a small bounding box around the drawing, padded with extra space to define the area of interest. -
Graph Construction:
Downloads a walkable street network from OpenStreetMap within the bounding box. -
Projection:
Projects both the map data and input points into a common coordinate system for accurate distance calculations. -
Start/End Nodes:
Finds the closest nodes in the graph to the start and end points of the drawing. -
Penalty Weighting:
Roads farther from the drawn shape are assigned higher penalties to discourage deviation. -
Route Calculation:
Runs a shortest-path algorithm to find the optimal walking route that best fits the drawing. -
Output:
Returns the route as a list of GPS coordinates in WGS84 format.Created by Andrii Bessarab, Adam Turaj, Jason Liang, and Jack Brown
