Find the flattest route between any two points in SF

(flattensf.com)

124 points | by ishan0102 5 hours ago

22 comments

  • andalinmicphew 3 hours ago
    Checkout https://bikehopper.org for solid elevation, bike infrastructure and transit-aware routing around the Bay Area. Some friends and I built this about 5 years ago and continue to maintain it. We use 1m DTM elevation data for SF and 50m for rural areas. DTM is a must for elevation based routing in SF as there are so many sizable buildings, large trees the other models fail hard.
    • laurencerowe 1 hour ago
      Very Cool. Thanks for making it!

      I've checked out a few bike mapping apps recently and one feature I found absolutely invaluable was grade indications like http://hillmapper.com (which unfortunately seems unmaintained.)

      Google Maps elevation diagrams comparing the various selected routes are nice but they do not do a good job of highlighting extreme grades. I feel like you actually want to graph the change in elevation rather than the elevation itself.

      Using a route I cycled the other day (near Mission Bernal Safeway to near Diamond Heights Safeway). I think the routing may overweight bike lanes too much. For instance it will go four blocks by shared street and bike lane to avoid the two blocks on Clipper between Sanchez and Castro which are not a bike lane.

      On my heavy cargo e-bike I've found there is quite a non-linear difference as the grade increases. 12% and I'll work a bit but be fine. 22% (the route Google Maps sent me...) and I'll all but collapse after a block.

    • bcraven 36 minutes ago
      Would a DSM not be preferable to a DTM? Or is that you reference with regards to large trees?
    • verst 3 hours ago
      Can you please consider expanding it to include Seattle? Or better yet Puget Sound area? 1m DTM elevation data is available here. We have many amazing bike trails, but also plenty of hills that must be avoided.
      • andalinmicphew 2 hours ago
        We’d like too! It’s an open source project that was never designed to scale beyond one regions (bay area, puget sound, NYC, etc…) our hope has always been been that folks in different regions would spin up their own copy. By keeping it regional the data and hardware requirements for running it are minimal. That said, we are working on a new routing engine that we hope can scale to support continent wide routing. Then we can manage running it for many metro’s. If you’re interested in self hosting for Seattle we are happy to help get it set up.
        • verst 2 hours ago
          What are the system requirements for hosting it? I'm not sure I have the discretionary funds to host it for the general public - but it all depends on how heavy this is :)
          • andalinmicphew 2 hours ago
            We run it on a single coolify box from someone’s house. 6 core, 32GB ddr4 memory box. The actual routing query are compute intensive but only momentarily. More cores and memory means higher concurrency but we’ve never had an issue with load in the Bay Area with a few hundred users a week. We used to run it on a k8s cluster but we cut it down to save on power and infrastructure management overhead.
  • danserfaty 4 hours ago
    It's not accurate. I mapped it from my house on Cabrillo St in the outer Richmond to 4th avenue and it says I need to climb 25th avenue then walk Geary instead of correctly telling me to use 23rd avenue that is completely flat.
    • jeffbee 4 hours ago
      I think this comes down to the DEM they are using. I think it would have come out better if they had used USGS 3DEP DTM at 25cm.

      Edited: which apparently is hosted for free on AWS S3.

    • almstimplmntd 3 hours ago
      ah, I think this is related to SF's "Slow Streets" program and a genuine bug in the parser.

      Cabrillo is a Slow Street, and the parser read its "destination-only" tag as closed to pedestrians, so the tool couldn't see the street at all (and started you a block over?). fixed and deployed; your trip should now go Cabrillo → 23rd → Geary.

      • jazzyjackson 3 hours ago
        “genuine bug in the parser” -> red flag for slop for those keeping track at home
        • dekhn 3 hours ago
          No need to be a jerk.
  • jez 3 hours ago
    It would be neat if it there were an option which added distance and elevation gain, but minimized the grade.

    For example, a route from SOMA to Nob Hill can be made flatter by approaching from either the east or west. Technically the "flattest" as measured by elevation gain between the two is straight up Taylor from Market, but it's much nicer to bike to the top of Nob Hill by going out of the way (e.g. Polk → California, Embarcadero → Broadway, etc.)

    • cowthulhu 2 hours ago
      I suspect that this would result in absurdly long routes. Imagine trying to go up a mountain while minimizing grade... you'd end up zig-zagging back and forth endlessly.
      • Serishmus 2 hours ago
        Isn’t that exactly how you build a trail up a mountainside? They are usually a series of switchbacks.

        Most people on most bikes can only take so much grade before climbing becomes impossible. A maximum grade setting would be very helpful for that exact reason.

        • cowthulhu 57 minutes ago
          Oh, yeah, I interpreted the parent comment as "minimize the grade" but if it's instead "keep grade below threshold" (for reasonable thresholds) that would make more sense.
        • frollogaston 2 hours ago
          I feel like even if the distances are equal, it's faster to walk a bike up a steep grade and bike the rest flat than it is to bike up a moderate grade the whole way. This topic has probably been discussed somewhere else.
          • kyleee 46 minutes ago
            But hike a bike is no fun, especially if trying not to sweat
  • pokpokpok 4 hours ago
    The wiggle!

    (in honor of my old commute, which I miss)

    https://flattensf.com/#t~-122.40850~37.77493~-122.50940~37.7...

  • laurencerowe 1 hour ago
    This seems to have the same issue I saw with Google Maps where it directed me along 29th St from near Mission Bernal Safeway to Diamond Heights Safeway. This includes a 22.7% grade! It's much faster and easier (at least on my cargo e-bike) to take the longer way around up Clipper St (12% grade).

    The bug seems to be apparent when you set the end point at Duncan & Diamond Heights Blvd and the start point directly north along Clipper.

    This route seems to maybe save 1 ft of climbing but goes up a 23% grade.

    https://flattensf.com/#t~-122.43968~37.74865~-122.44028~37.7...

    Half a block up the street it takes the sensible route with only a 13% grade. (Between the two different starting points is 41ft of climbing.)

    https://flattensf.com/#t~-122.44087~37.74864~-122.44028~37.7...

    • almstimplmntd 37 minutes ago
      good point.. the slider trades distance against total climbing and nothing else. steepness is currently reported but not optimized.

      seems like a worthy addition to the objective!

  • geor9e 1 hour ago
    It's telling me to bike on Geary and Divisadero. No thank you I'd rather stay alive.
  • askjdfksdbfhk 3 hours ago
    There's a weird thing going on at 22nd and San Jose in the Mission, where it doesn't seem to understand that you can simply continue down 22nd, but instead takes a hook down San Jose before backtracking. I see some other weird discontinuities like this as I click around.

    I have to say that the Claude UI has made many inexplicable decisions here, including (but not limited to) the mysterious color coding, the confusing continuous slider over a discrete set, and the weird positioning of the height labels in the altitude graph.

  • scaredginger 3 hours ago
    This is great. Since SF is mostly a grid, I used to use the heuristic of only choosing paths that wouldn't take me further from my destination, avoiding going downhill but choosing the shallower uphill climb if a choice is given.

    Other than knowing the direction of my destination, it only used local information

  • varenc 1 hour ago
    I need something like this for car routes. I have an old diesel car that goes very slowly up hills. Will top out around 35mph if I'm going up a steep highway grade and towing.

    I've tried finding tools for truckers but none quite worked. In a pinch I'll use bike mode on Google Maps for its elevation planning. But it always wants me to move off highways to side roads of course.

  • cheeaun 3 hours ago
    Cool, I used to build this https://github.com/cheeaun/steepless (2014)
  • mvkel 4 hours ago
    Absolutely love the live profile updating when you swipe from flatter to shorter.
  • jdxcode 3 hours ago
    someone should make flattendallas.com as a joke
  • nerdtalker 2 hours ago
    You should consider adding drive as well, some of us have manual transmissions still, although the Bike mode returns pretty reasonable results.
  • Terr_ 4 hours ago
    > The slider runs along the whole trade-off between distance and climbing [...] Climbing is cumulative gain

    Another mechanism might be a kind of user-defined cost-curve, where a gradual climb to 10 might be preferred over a steep climb to 8, etc.

  • ziofill 2 hours ago
    Sorry if this is a stupid question, but isn’t the climb independent of the route?
    • geor9e 1 hour ago
      Your net elevation change is just the difference in altitude between your starting point and your ending point. So yes, it’s independent of route, but that’s not what the term “climb” refers to. It’s not a net elevation change; it’s a cumulative elevation gain, because in bicycling and walking the in‑between parts burn energy. Human legs don’t have regenerative braking, so every time you gain a foot of altitude you don’t get those calories back when you lose a foot of altitude.
    • jacobn 2 hours ago
      Not if there are hills in between. But the delta between A and B is the best you can do, yes.
      • degamad 1 hour ago
        In addition, while the net elevation change is bounded by the delta, given the choices might be "go up this steep section" vs "go along this gentle incline", one route can be "flatter" between the same endpoints.
  • very_good_man 54 minutes ago
    I love Trick Dog!
  • qurren 4 hours ago
    Doesn't Google Maps in bicycle mode already do this?
    • Arainach 3 hours ago
      There are many constraints to satisfy, and avoiding hills is but one of them.

      Most of us would take a hill with a protected bike lane over a flat 45mph.

  • tedd4u 4 hours ago
    Cool! Any way to toggle on street names on the map?
  • wmichelin 1 hour ago
    It’s all just the wiggle lol
  • fnord77 4 hours ago
    Try downtown to somewhere in Bernal, say Progressive Grounds coffee house.

    The flattest route is only 0.2 miles longer than the shortest, but goes from 200ft of climbing to 500ft of climbing, 12% max grade to 22% max grade.

    Apple maps picks the shortest every fucking time.

  • jew-and-proud 1 hour ago
    [flagged]