Inspiration
From first-hand perspective, we love running. Inspired by our physical interests and viral videos of people running outdoors to track massive messages on GPS, we created Draw2Route to help everyone get outside and make amazing creations. It definitely beats running on a treadmill!
What it does
Draw2Route turns a user's freehand drawing into a physical course on the road. Our program lets our user's choose the location, orientation, and scale of their drawing to best suit their environment and fitness level. The final result outputs a path with Google Maps that is fun to run and rewarding to draw.
How we built it
Our system uses Svelte frontend and a Flask backend hosting the core logic. The user interacts by drawing a desired route shape, selecting a start point, and choosing a destination. This input, a list of GPS points sourced from Google Maps, is fed to the Draw2Route algorithm. The algorithm begins by identifying the bounding box of the input coordinates and downloading the relevant OpenStreetMap (OSM) data to construct a 2D graph of all walkable paths. For accurate distance computations, both the graph and the input coordinates are projected into the graph's local coordinate system. The algorithm then maps the start and end of the user's input to the closest nodes on this graph. To find the optimal path, it implements a penalty-weighted pathfinding system: the further an edge deviates from the corresponding segment of the desired shape, the higher its "penalty weight". This mechanism ensures the resulting path strongly favors the shape most alike to the user's drawing. Finally, the algorithm returns the optimized route as a list of coordinates in WGS84 (GPS) format.
Challenges we ran into
We pushed well beyond our comfort zone for this project. Getting the algorithm into a working state was a huge challenge and incredibly rewarding when we finally pulled it off. But it wasn't easy. The first half of the day was a massive brainstorm for potential solutions. Without a clear idea on what plan worked best our team split into two camps to work on the algorithm up until the late afternoon, when our weighing algorithm prevailed.
Accomplishments that we're proud of
The first time we saw our street routes accurately match our drawing was incredible. All of our work built toward that moment, so seeing how frontend and backend could come together so seamlessly was indescribably satisfying.
What we learned
A majority of our project contained Svelt, Flask, and Linear Projections-- all things we have never coded before individually or as a team. This hackathon was an excellent opportunity to throw ourselves into these new skills and make something pretty cool with them.
What's next for Draw2Route
The primary challenge facing the current Draw2Route algorithm stems from the penalty weighting system's behavior when the starting and ending nodes are close to each other. In these instances, the program tends to favor the shortest path directly connecting the two nodes rather than strictly adhering to the user's desired closed shape, making it particularly difficult to generate routes with closed geometry, which is very common in running. This requires a dedicated approach, treating closed geometry as a special case within the algorithm to significantly enhance performance and utility. Beyond this, the program's utility could be expanded by introducing user-customizable parameters that allow users to select factors such as the types of roads included in the graph (e.g., preference for trails or major roads) or to tune the trade-off between path simplicity and shape-matching accuracy. Finally, exploring licensing opportunities with established platforms like Strava could be a key strategy for reaching a much larger audience.
Log in or sign up for Devpost to join the conversation.