Get hiking suggestions from your recorded tours

Colorful and in Color

To make the meta values of the printed tours more eye-catching later on, Listing 5 initially includes the fatih/color package from GitHub, which provides functions to output the ANSI color codes commonly used by terminals.

You can compile Listings 4 and 5 with the usual three-card trick (Listing 6). The resulting hikefind binary either outputs all tours (Figure 5, without command-line options) or gives you a more compact selection using arbitrary combinations of the different filter types.

Listing 6

Compiling

$ go mod init hikefind
$ go mod tidy
$ go build hikefind.go csvread.go
Figure 5: When called without options, hikefind lists all available trails.

Figure 6 shows all the hiking trails within 10 kilometers of my adopted hometown of San Francisco that climb less than 100 meters in elevation and can be completed in one hour or less. Only three routes remain – it's a pretty hilly city after all.

Figure 6: Use the filter options to create a selection entirely to your liking.

Infos

  1. "Go Retrieves GPS Data from the Komoot App" by Mike Schilli, Linux Magazine, issue 252, November 2021, https://www.linux-magazine.com/Issues/2021/252/Plan-Your-Hike/(language)/eng-US

The Author

Mike Schilli works as a software engineer in the San Francisco Bay Area, California. Each month in his column, which has been running since 1997, he researches practical applications of various programming languages. If you email him at mailto:mschilli@perlmeister.com he will gladly answer any questions.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Plan Your Hike

    The hiking and cycling app komoot saves your traveled excursion routes. Mike Schilli shows you how to retrieve the data with Go.

  • GPS Tools

    Almost all manufacturers of GPS devices use proprietary formats to save routes, tracks, and waypoints. Vendors unfortunately rarely offer Linux software for uploading and downloading or processing the data. Four GPS editors keep Linux users on the right track.

  • Tutorials – Apache Spark

    Churn through lots of data with cluster computing on Apache's Spark platform.

  • Knight's Tour

    If you're looking for a head start on solving the classic Knight's Tour chess challenge, try this homegrown Python script.

  • Wanderlust

    For running statistics on his recorded hiking trails, Mike Schilli turns to Go to extract the GPS data while relying on plotters and APIs for a bit of geoanalysis.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News