Inspiration

Modern navigation apps are fundamentally designed for cars, optimizing for one single metric: speed. But for pedestrians, runners, and cyclists, the fastest route is rarely the healthiest or most enjoyable. Walking next to a concrete, 6-lane highway might be efficient, but it induces stress.

We wanted to use technology to actively support mental and environmental health. We were inspired by the idea of "micro-nature": the small pockets of greenery, tree-lined streets, and urban parks that city dwellers pass by every day. TerraRoute was born from a simple question: What if our maps optimized for human well-being instead of raw distance?

What it does

TerraRoute is a pedestrian routing engine that calculates walking paths based on environmental quality.

Users select a start and destination, and are presented with two options: the standard fastest path (grey), and the TerraRoute (emerald). Using our custom Serenity Slider (scaled 0 to 100), users can dynamically adjust their preferred trade-off between travel time and nature exposure. As you drag the slider, the algorithm instantly recalculates the path, pulling you away from heavy traffic and routing you through parks, pedestrian paths, and tree-canopied streets.

How we built it

We built TerraRoute as a full-stack web application, focusing heavily on custom algorithmic routing rather than just wrapping an existing navigation API.

  • Backend & Data Processing: We used Python and FastAPI to build a high-performance routing server. We leverage OpenStreetMap (OSM) data to construct a traversable street graph using networkx and osmnx.
  • Geospatial Analysis: We query OSM for specific environmental tags (leisure=park, natural=wood, landuse=grass) and street types (boosting highway=pedestrian, heavily penalizing highway=primary). Every edge in the street network is assigned a normalized greenery score in the range of $[0, 1]$.
  • The Custom Routing Algorithm: Instead of standard distance minimization, we implemented a custom bounded Dijkstra algorithm. The algorithm minimizes a dynamic cost function calculated as: $$Cost(e) = L(e) \times (1 + \alpha \times (1 - G(e)) \times k)$$

Where:

  • $L(e)$ is the physical length of the street edge in meters.
  • $G(e) \in [0, 1]$ is the computed greenery score (1.0 = highly natural, 0.0 = concrete/traffic).
  • $\alpha \in [0, 1]$ is the user's real-time Serenity Slider weight.
  • $k$ is our tuned penalty constant.

  • Frontend: The client is built with Vite + React, using Tailwind CSS for styling and MapLibre/Leaflet for rendering the custom GeoJSON route vectors smoothly over a minimalist map interface.

Challenges we ran into

The "Infinite Detour" Problem: Early versions of our algorithm would route users 5 miles out of their way just to walk through a small patch of grass because the penalty for concrete was too severe. We had to spend significant time mathematically tuning our cost function's penalty constant ($k$) and implementing bounds within our Dijkstra implementation to ensure the green detours remained logical and human-sensible.

Live Data Reliability vs. Hackathon Demos: Querying massive geographical data from OpenStreetMap live can be slow and is subject to API rate limits. To ensure zero crashes, we implemented a dual-mode architecture. By default, the app runs on deterministic offline city models cached locally as serialized graphs (answering requests in under 150ms). Users can explicitly click "Use live OSM streets" to swap in real-time network data, which gracefully falls back to the cache if the external API throttles.

What's next for TerraRoute

To make TerraRoute even better, we want to integrate real-time APIs. Adding a live weather layer (to avoid muddy dirt paths after rain for accessibility) and a live traffic/noise-pollution layer would make the Serenity Score even more accurate. We also envision an Apple Watch / WearOS integration so users can follow their green routes via haptic feedback without looking at a screen, fully immersing themselves in nature.

Built With

Share this project:

Updates

Submission history