logo
Kurashizu Blogwhere ideas flow
  • Home
  • News
  • Blog
  • About
  • Home
  • News
  • Blog
  • About

© 2026 Kurashizu. All rights reserved.

Admin·New Post·Service Status
Powered by Cloudflare·30.10.26
← Back to news

Find the flattest route between any two points in SF

Original article
flattensf.com|274 points|95 comments|by ishan0102|Oct 5, 2026

Navigating San Francisco's Hills: An Overview of Flatten SF

Created by Drew Edwards, Flatten SF is a specialized routing tool designed to help users identify the least strenuous paths between any two locations within the city of San Francisco.

Flatten SF Interface Placeholder

🛠️ Core Functionality

The application allows users to input a starting point (From) and a destination (To). For cyclists, there is a specific toggle to Prefer calm streets, which adjusts the routing logic based on street safety and comfort.

The tool provides real-time data on:

  • Total distance (Shortest)
  • Total elevation gain (Flattest)
  • Maximum steepness encountered

⚙️ How the Engine Works

Routes are calculated locally within your web browser. The system analyzes over 160,000 individual street segments, leveraging high-resolution USGS 1m lidar elevation data combined with the Overture / OpenStreetMap street graph.

The Trade-off Slider

The interface features a slider that manages the tension between distance and vertical climb. It identifies the "Pareto frontier"—routes where no other path is simultaneously shorter and flatter.

The Logic:

  • Moving the slider right: The route will either stay the same length or get longer, but it will never increase in climbing.
  • The Limit: The flattest possible route is determined by a specific cost ratio: 1 ft of climbing=200 ft of walking\text{1 ft of climbing} = 200 \text{ ft of walking}1 ft of climbing=200 ft of walking If a detour exceeds this ratio, the system stops considering it a viable route.

Understanding "Climbing"

It is important to note that the tool measures cumulative gain. Net elevation difference between start and end →\rightarrow→ Total ascent.


🚲 Cycling & "Comfort" Metrics

When the "Prefer calm streets" option is enabled, the algorithm stops measuring raw distance and starts measuring "comfort distance." This is calculated by applying a multiplier to the actual length of the street segment:

Street TypeComfort WeightDescription
Protected Lane/Path0.8SFMTA bikeway network
Quiet Street1.0Standard residential/low traffic
Busy Arterial1.4 to 2.0High traffic, no dedicated lane
// Conceptual logic for comfort distance
function calculateComfortDistance(length, streetType) {
  const weights = {
    'protected': 0.8,
    'quiet': 1.0,
    'arterial': 1.7 // average of 1.4 - 2.0
  };
  return length * weights[streetType];
}

🗺️ Data Architecture

The search functionality is entirely offline. All necessary data—including street intersections, specific addresses, and points of interest within San Francisco—are embedded directly into the page.