Lurker News
Hi HN! This is a trail companion web app (think AllTrails) I hacked together in a couple weeks time. I was inspired to create this project while training for an extended backpacking trip. My motivation was to create a UI tailored exactly to my liking, and to be able to track my progress along the trail without draining my battery. I also wanted to experiment with PWA technologies.

I successfully used it on my five day adventure along the Knobstone Trail in southern Indiana, and even though it's web-based it hardly consumed any battery life on my old first-gen Pixel XL.
It's set up currently to support a single trail, where the trail and trail markers are deployed with the rest of the app. So it's single-use in that way. For future trips, I can simply swap out the GPX files and deploy.
I am releasing it with an open source license in case anyone wants to use it as a boilerplate to create their own.

Comments (141) 39 threads

Earlier comments
ghostbrainalpha#
I like this a lot.

The All Trails cost seems too much for me, because my hiking is limited to 1 or 2 trails.
I'm going to see if I can draw my own trail with the GPS visualizer this weekend!

kstrauser#
Although not identical in features, I heartily recommend WorkOutDoors (http://www.workoutdoors.net) to anyone who owns an Apple Watch. It's brilliant as an offline hiking buddy.
solardev1 reply#
This is great! Thanks for sharing!

Can I ask you how calculated the slope gradients (if I'm reading that right? like red = steep?)

jameal#
I wish I had time to have built that part myself! I'm leaning heavily on open source plugins like these [1][2]. The gradients are representative of elevation. So red = highest points along the trail and green = lowest points. Where you see sharp gradients from green to red is where the steepest slopes are. There is slope graph that can be setup in the plugin configuration.

[1] https://github.com/Raruto/leaflet-elevation [2] https://github.com/iosphere/Leaflet.hotline

zach_garwood1 reply#
Can you recommend any resources for setting up the service workers and manifest for a PWA?
jameal#
MDN's web docs were instrumental. They have a nice guide[1]. Beyond that, their docs for the web APIs are great too.

It was actually pretty easy, but I did get tripped up by the scope of the service worker. Initially I had the service worker js file in the `scripts` folder but it wouldn't work properly because the scope is by default relative to that file's location. I moved it to the root and that fixed my problem but you can also configure the scope when you register it[2].
[1]: https://developer.mozilla.org/en-US/docs/Web/Progressive_web... [2]: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWork...

Load more comments