News for hackers. Stuff that matters.
Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Saturday July 11, 2020 @10:09AM (#23802323)
Author here. Trail Router is a running route planner that prefers greenery and nature in the routes it generates, and biases against busy roads. It can generate round-trip routes that meet a specified distance, as well as point-to-point routes.

I've written a detailed blog post about how Trail Router works here: https://trailrouter.com/blog/how-trail-router-works/

I developed this because I am (or was...) a frequent traveller for work, and I like to run wherever I visit. But I don't enjoy running on busy main roads, and I found that without careful and time consuming route planning that is often what would end up happening if I didn't know the area. Trail Router is my solution to this problem.

After a previous discussion (https://news.ycombinator.com/item?id=23177351) received quite a lot of attention, dang reached out to suggest I post a Show HN to reach a wider audience. I've addressed some of the original feedback too - for example, you can now prefer hills in your routes, as well as avoid them.

Re:Show HN: Trail Router – generate running routes that pref... by pj_mukh on Saturday July 11, 2020 @01:47PM (#23804078)
We sorely need this for cycling. Komoot is the closest thing but it doesn’t do mileage requests like your app here.

This is awesome!

EDIT: In addition to optimizing for green routes, optimizing for low speed car zones would be a killer feature.

Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Saturday July 11, 2020 @01:56PM (#23804154)
Thanks! Cycling is on the to-do list. But I'm conscious it probably wouldn't just be a single category - there would need to be separation for road cycling and mountain biking.

The routing algorithm does already prefer roads with low speed limits, but there is definitely more that could be done in this space (e.g. a slider to set a preference to avoid higher speed roads). It also depends on the availability of speed limit data (I use the OpenStreetMap database).

Re:Show HN: Trail Router – generate running routes that pref... by pistoriusp on Sunday July 12, 2020 @07:19AM (#23810544)
I frequently do 50km - 60km cycling routes from my home and I've manually figured out the greenest and least busiest routes.

I tested it with your app and the route is near identical to what I've figured (over the course of several thousand km's of trial an error).

I'm amazed!

Edit: I'm usually on a mountain bike.

Re:Show HN: Trail Router – generate running routes that pref... by nickswan on Saturday July 11, 2020 @02:35PM (#23804513)
You could almost do with a ‘how safe you felt’ rating for each road. Would obviously take a while to build up the data.
Re:Show HN: Trail Router – generate running routes that pref... by 076ae80a-3c97-4 on Saturday July 11, 2020 @02:29PM (#23804448)
The state of apps/web apps for planning road cycling routes is abysmal. If you can implement this you'll immediately be the best.
Re:Show HN: Trail Router – generate running routes that pref... by cullenking on Saturday July 11, 2020 @10:38PM (#23808270)
I am curious why you think this. I run https://ridewithgps.com and always love constructive feedback to improve. There’s always improvements to make, but I wouldn’t quite go as far as calling things abysmal!
Re:Show HN: Trail Router – generate running routes that pref... by c0nsumer on Sunday July 12, 2020 @11:58AM (#23812277)
One of the main reasons for this is a lack of data. The Strava Heatmap (crowdsourced data, based on past frequency of use) is pretty much the best. OSM tagging is insufficient for real good routing, and it doesn't take traffic patterns into account.

Thus, a lot of route creation is dependent on hyperlocal knowledge. Strava Route Builder, with the heatmap, goes fairly far on this, but it too isn't the best.

This is a really hard problem to solve.

Re:Show HN: Trail Router – generate running routes that pref... by malyk on Sunday July 12, 2020 @09:25AM (#23811143)
footpath is pretty great for planning and adding features regularly
Re:Show HN: Trail Router – generate running routes that pref... by goguy on Sunday July 12, 2020 @04:18AM (#23809790)
The new Strava feature is pretty good IMO
Re:Show HN: Trail Router – generate running routes that pref... by donjoe on Saturday July 11, 2020 @05:06PM (#23805989)
cycle.travel does have a feature for mileage requests. It is not very much optimized for dirt routes though...
Re:Show HN: Trail Router – generate running routes that pref... by Doctor_Fegg on Saturday July 11, 2020 @05:16PM (#23806075)
Thanks for the recommendation - cycle.travel’s my site!

I’d like to do a dirt/gravel profile. Main reason I haven’t so far is that it’s very hardware-intensive (as in tipping over into renting another Hetzner box).

Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Saturday July 11, 2020 @06:31PM (#23806709)
How funny, Trail Router also happens to be hosted with Hetzner. Right now in their auction there's a E5-1650v3, with 256GB RAM and 2x 480GB SSD for 73 EUR/mo (including VAT) - which is exactly what Trail Router runs on. That's incredibly good value for money. Lots of RAM is crucial for applications like this.
Re:Show HN: Trail Router – generate running routes that pref... by karussell on Saturday July 11, 2020 @07:04PM (#23806956)
I think Doctor_Fegg means that he needs one new server per vehicle profile (?) as OSRM is used for cycle.travel and it does not allow multiple vehicle profiles unlike GraphHopper ;)
Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Saturday July 11, 2020 @07:12PM (#23807017)
I didn't know that. I've been spoiled by the always wonderful GraphHopper. Thank you for your tireless work on GraphHopper! Trail Router and many other projects would not be possible without it.
Re:Show HN: Trail Router – generate running routes that pref... by karussell on Saturday July 11, 2020 @07:29PM (#23807136)
Thanks!

And thanks for building on top of it and making a useful app :)

Re:Show HN: Trail Router – generate running routes that pref... by Doctor_Fegg on Sunday July 12, 2020 @04:15AM (#23809778)
Well, kind of. cycle.travel runs on my fork of OSRM which does allow multiple profiles. But it still needs a separate hierarchy for each one, which would be another 14GB RAM.
Re:Show HN: Trail Router – generate running routes that pref... by karussell on Wednesday July 15, 2020 @05:19PM (#23852011)
Aha, thanks for sharing this, didn't know that this is possible with OSRM too
Re:Show HN: Trail Router – generate running routes that pref... by donjoe on Saturday July 11, 2020 @05:24PM (#23806146)
Man thanks so much for your work! Been using it for some time now especially for planning long distance routes. That's where cycle.travel really shines (plus I really love the 3D altitude visualization ;-)).

I usually tend to export routes and navigate with komoot. Komoot for long distance planning is terribly slow as soon as you hit ~200km+.

Re:Show HN: Trail Router – generate running routes that pref... by karussell on Saturday July 11, 2020 @07:13PM (#23807026)
I just wanted to reply this cannot be as Komoot is also using CH (fast routing algorithm using GraphHopper) but yes, they are relative slow for fast routes. The reason seems that they create a very big response (5MB) in these cases and then it takes more seconds to visualize this. For current & original GraphHopper the response is highly optimized and so it is much smaller (20x) even with comparable road data (like elevation, surface, bridges/tunnels and road class)

btw: in general Komoot is a nicely polished app. I can only recommend it :)

Re:Show HN: Trail Router – generate running routes that pref... by donjoe on Sunday July 12, 2020 @02:19AM (#23809300)
I absolutely agree. Routing using a phone is loads of fun. I do have the paid version and I highly appreciate their open source-ish character.

Besides large response data and a slaggish planning interface @ komoot: try routing from northern Italy to Sicily: Komoot doesn't seem to know the ferry departing in Villa s. Giovanni to Messina. Komoot will always - no matter how may vias you place - route you back north and send you on a ferry in Salerno. Yes, I know, I could split my route and such. Yet, I love the idea of my planning tool to show me the complete route - including official transportation ;-)

Re:Show HN: Trail Router – generate running routes that pref... by stugrey on Saturday July 11, 2020 @05:51PM (#23806403)
Maybe check out Huli who are working on exactly this amongst other things https://huli.life/
Re:Show HN: Trail Router – generate running routes that pref... by notatoad on Saturday July 11, 2020 @08:56PM (#23807671)
this actually looks pretty cool, but if i'm being honest i just want to use it because they had the guts to call their company hooli.
Re:Show HN: Trail Router – generate running routes that pref... by efrecon on Sunday July 12, 2020 @02:50AM (#23809407)
huli looks promising, but they just have cycling right now. It's a no go for long(ish) runners.
Re:Show HN: Trail Router – generate running routes that pref... by rorykoehler on Saturday July 11, 2020 @05:16PM (#23806077)
Komoot does mileage requests. I use it nearly every ride.
Re:Show HN: Trail Router – generate running routes that pref... by mvkel on Sunday July 12, 2020 @11:55PM (#23817001)
This already exists! It’s an app called EasyRoute
Re:Show HN: Trail Router – generate running routes that pref... by cullenking on Saturday July 11, 2020 @10:46PM (#23808322)
Hey Sam, I run ridewithgps.com and have been reaching into the guts of graphhopper to do interesting routing stuff as well. We just silently rolled out popularity based routing, where we used our database of 50mm rides to build a popularity graph which is used to add a popularity weight in routing decisions. Got a long pipeline of other projects coming out in the same space. Drop me a line if you ever want to yack about these things! [email protected]
Re:Show HN: Trail Router – generate running routes that pref... by TrueGeek on Saturday July 11, 2020 @11:37PM (#23808594)
Are you guys considering adding in more social features to compete with Strava? It’s seems an excellent opportunity right now with so many people upset with them. A simple UI update showing a feed, add a kudos system... you’re halfway there.
Re:Show HN: Trail Router – generate running routes that pref... by cullenking on Sunday July 12, 2020 @12:56AM (#23808950)
That's actually one of our main focuses over the next two months, along with mapping and routing improvements. We've seen a decent uptick in people migrating, and they are asking for more social stuff. We've always been shy about becoming a social network, so our focus is on making it much easier to connect with people you know, see what they are doing, while making it optional and not pushing it too hard to our existing users.
Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Sunday July 12, 2020 @03:09AM (#23809489)
I certainly will, thanks! And congratulations on all your success with Ride with GPS. I'm not really a cyclist, so I only used it for the first time last night, but it looked and worked great for me.
Re:Show HN: Trail Router – generate running routes that pref... by cullenking on Sunday July 12, 2020 @01:10AM (#23809002)
Reply to my own reply to say, I forgot to mention this is really cool, and a fun use of OSM data I hadn't thought of before. Nice work!
Re:Show HN: Trail Router – generate running routes that pref... by Schweigi on Saturday July 11, 2020 @09:55PM (#23808020)
Wow, great project. I was working on exactly this in 2015 using Grasshopper but never finished it. I like how much time you invested to solve all the tiny details around the edge cases. Like prefering certain streets, no-hills and trying not to run the same street twice. It wasn’t clear to me from the blog article, does prefer “green” also prefer water areas?
Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Sunday July 12, 2020 @02:35AM (#23809357)
Thanks! Yes, the "greenery" preference also prefers water.
Re:Show HN: Trail Router – generate running routes that pref... by fouc on Sunday July 12, 2020 @07:16AM (#23810537)
It would be nice if the water preference could be adjusted in preferences perhaps.
Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Sunday July 12, 2020 @07:23AM (#23810556)
Thanks, I'll consider breaking those two things out separately.
Re:Show HN: Trail Router – generate running routes that pref... by c0nsumer on Sunday July 12, 2020 @11:55AM (#23812252)
Thank you for doing this.

For years I've contributed trail data to OpenStreetMap, mostly to support mountain biking, but this is the exact kind of other project it benefits. It was really neat being able to try this on local trails and see just what happens.

One question: What tags does it give priority to?

I ask because I tried it on a local trail system, and it seemed to prefer the wide paved and dirt path as opposed to the mountain bike trail. It was weird in that sometimes it'd use the single track, but in others it'd do sort of an awkward thing through the parking lot / service road (highway=service, service=parking_aisle) then use some of the single track (eg markers 1-2) before jumping on the paved path and pretty much ignoring the single track. The single track is really popular with trail runners in this park, so it got me wondering.

An example of that is here:

https://trailrouter.com/#wps=42.65195,-83.05484%7C42.65088,-...

Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Monday July 13, 2020 @02:58AM (#23817803)
Thanks for all your contributions to OSM! If you ignore all of the greenery preference then it gives priority to tags:

foot=designated route=root, hiking highway=footway, path, track, bridleway, pedestrian, living_street, residential, service, unclassified maxspeed < 20km/h

Looking at your area (https://www.openstreetmap.org/way/191828180#map=15/42.6423/-...), all of the trails are given equal preference. As a result, it then falls back to whichever gives the shortest path. It's choosing the asphalt one (linked above) just because it's the shortest path. In the future, I may add a surface preference option - so you could give additional preference to non-paved paths.

Re:Show HN: Trail Router – generate running routes that pref... by c0nsumer on Monday July 13, 2020 @03:02PM (#23824321)
Thank you very much for explaining that. That makes a lot of sense. I really wish there was a better way for tagging things like narrow/twisty natural surface trails vs. wide flat ones, but that seems all balled up in US vs. EU hiking things, MTB tagging... It's a mess.

(Making it worse, someone naively editing a mountain bike trail in iD will end up inadvertently flagging it as highway=cycleway. And then people using OSM for cycling directions get routed down an MTB trail... Yay.)

Re:Show HN: Trail Router – generate running routes that pref... by karussell on Saturday July 11, 2020 @07:48PM (#23807249)
The blog post provides a lot of insights. Good read. Some questions.

Do you plan to support area routing?

And you write: "However, the good news ended there: Openrouteservice does not publish the code for calculating this green index". Is your code publicly available and allows "the news to end good" ;) and maybe even integrated elsewhere?

Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Sunday July 12, 2020 @03:39AM (#23809601)
Area routing is definitely a topic of interest. It looks like it's still a topic of discussion too: https://github.com/graphhopper/graphhopper/issues/82. Maybe it's something I can help with in the future.

Good point RE the green index calculation. The very least I could do would be to upstream a reference implementation and documentation back to Openrouteservice. I will take care of that.

Re:Show HN: Trail Router – generate running routes that pref... by lfuller on Saturday July 11, 2020 @06:01PM (#23806487)
This is actually a wonderful product - thanks for making it! I've looked for a website that did this for a long time, and this works surprisingly well. It actually produced a route that is very similar to one I found myself.
Re:Show HN: Trail Router – generate running routes that pref... by def8cefe on Saturday July 11, 2020 @11:56PM (#23808671)
Have you considered creating an option to generate the closest all-nature route (not factoring in walking distance to the running route which you could use as a warm-up)?

Very neat app.

Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Sunday July 12, 2020 @03:14AM (#23809502)
Nice idea - consider it added to the potential todo list for the future. Thanks!
Re:Show HN: Trail Router – generate running routes that pref... by ddoeth on Monday July 13, 2020 @02:10AM (#23817601)
I think there might be a bug, check this out: https://imgur.com/a/DXhMWxG

I know for a fact that the second one is about right, because I ran it already. The first one however is somehow showing "shorter" kilometers, by the end it should be about 2.5km. Did I do something wrong?

Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Monday July 13, 2020 @02:48AM (#23817751)
The first one is an "out-and-back" (so it goes out 2>3>4>5, and then back 5>4>3>2).
Re:Show HN: Trail Router – generate running routes that pref... by ddoeth on Monday July 13, 2020 @03:52AM (#23818226)
Is there any way too see this? Because for both I selected Round trip.

Also the first kilometer seems way too short in comparison to the second

Edit: Wait, the numbers are not every kilometer, right?

Re:Show HN: Trail Router – generate running routes that pref... by samcrawford on Monday July 13, 2020 @04:14AM (#23818391)
There's no easy way to see it at the moment, other than looking at the waypoint list (the box at the top left). One idea I'm looking at is putting arrows on the line - so in this case you'd see arrows going both ways on the line.

And yes, the numbers do not represent km, they represent the numbered waypoints listed in the top left box. Any usability suggestions are very much welcome!

Re:Show HN: Trail Router – generate running routes that pref... by ddoeth on Tuesday July 14, 2020 @02:10AM (#23829041)
Thanks, yes. I think it would be nice to have some kind of range indication, maybe the waypoints could be letters so they don't get confusing?

And then you can toggle distance measurements.

And for the direction problem, maybe a change of color every kilometer or a gradient? Although that might also be confusing.

Re:Show HN: Trail Router – generate running routes that pref... by nathancahill on Sunday July 12, 2020 @08:48AM (#23810931)
Wow! I tried several different length runs, ever single one _perfectly_ matched some of my favorite routes. Shockingly good.
Re:Show HN: Trail Router – generate running routes that pref... by runnr_az on Saturday July 11, 2020 @09:10PM (#23807739)
Super cool... this is definitely a thing I’ll use