deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

Flatten SF finds the flattest routes over 160,000 San Francisco street segments in the browser

Flatten SF, by Drew Edwards, computes minimal-climb routes across 160,000 San Francisco street segments entirely in the browser, using USGS lidar elevation and Overture/OpenStreetMap data.

Flatten SF finds the flattest routes over 160,000 San Francisco street segments in the browser

A routing engine that optimises for hills

Anyone who has walked San Francisco knows the shortest route is rarely the easiest one. Flatten SF, a site by Drew Edwards that surfaced on the Hacker News front page on 5 October, is built around exactly that problem: pick two points in the city and it traces the path that demands the least climbing rather than the fewest metres.

According to the site, all of this happens locally in the visitor's browser, over a street graph of roughly 160,000 segments. The graph merges Overture and OpenStreetMap street data with one-metre-resolution lidar elevation from the USGS, which is what gives the tool its grasp of the city's gradients.

A slider across every sensible trade-off

The centrepiece of the interface is a slider, and it is not a crude dial between short and flat. The site exposes the full set of routes that no other option beats on both distance and climbing — effectively a Pareto frontier of paths. At one end sits the plain shortest path. At the other sits the flattest detour the author deems worth taking: the point where a foot of ascent costs 200 feet of extra walking, past which the results become too circuitous to count as real routes.

Dragging toward flatness carries two guarantees, the site says: the route never gets shorter, and it never gains climbing. The other candidates along the trade-off are drawn as faint lines, so the whole family of reasonable routes is visible at once instead of hidden behind repeated queries.

One definitional choice shapes all the numbers: climbing is measured as cumulative gain, not the net elevation difference between the endpoints. Descents do not cancel earlier ascents, which tracks how effort actually accumulates on foot.

Details in the graph

Travel modes are handled differently. Stairways, a genuine part of San Francisco's pedestrian network, are permitted when routing on foot and excluded when routing by bike.

Place search is offline too. Intersections, named places and addresses for San Francisco are baked into the page, so locating a start and end point needs no server round-trip. Edwards also publishes the source, the underlying data and a fuller write-up of the analysis.

Why it matters

Mainstream routing services optimise for time or distance and treat elevation, at best, as a footnote. For pedestrians, cyclists and anyone for whom a steep block is a real obstacle, that is the wrong objective function, and Flatten SF shows the alternative is both computable and straightforward to present.

It is also a compact demonstration of how much heavy work a modern browser can do alone: graph search over 160,000 weighted edges, offline geocoding for an entire city, and a multi-objective result set rendered as an explorable frontier, with no backend in the loop. As open street datasets like Overture and OpenStreetMap and public lidar coverage become easier to combine, this kind of specialised, local-first tool gets cheaper to build — and the slider-plus-faint-lines pattern for exposing trade-offs is one other mapping tools could usefully copy.

  • #routing
  • #openstreetmap
  • #maps
  • #browser
  • #lidar