7

Pytopo: Colorizing Lines According to Speed or Elevation (30 Day Map Challenge #...

 9 months ago
source link: https://shallowsky.com/blog/mapping/pytopo-line-colorization.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Pytopo: Colorizing Lines According to Speed or Elevation (30 Day Map Challenge #2)

[PyTopo screen with a track colorized by elevation]

I've been wistfully watching the hashtag #30DayMapChallenge on Mastodon. For several years in a row, I've told myself I'm going to try the 30 Day Map Challenge ... and each time, I get busy with other stuff. And this year is no different.

So instead of trying to do all thirty exercises, I'll just do a few of the challenges when I have time and motivation. Better than nothing, right?

And as it happened, yesterday I got the urge to do a map-related project. Except it lined up with Day 2, whereas I didn't get it working til this morning.

So, two days late, here is my:

30 Day Map Challenge Day 2: Lines

During a bike ride along the fast section of one of our fantastic White Rock trails, I found myself wishing I could view my track logs colorized according to how fast I was going. And I realized that I could pretty easily add that to PyTopo's track log displaying code. And as long as I was doing that, why not also add the ability to colorize by elevation as well?

Most GPX track logs already include elevation (though the ones I get from OsmAnd aren't super accurate: they're GPS elevation rather than using the barometric sensor that some phones have). Track logs from OsmAnd sometimes include speed, via the nonstandard construct

        <extensions>
          <osmand:speed>0.3</osmand:speed>
        </extensions>

which PyTopo already knows how to parse; and of course, for track logs that don't include speed, it can be calculated according to the distance and time difference from the previous track point.

[PyTopo screen with a track colorized by speed]

Indeed, it was pretty easy to add. I put it on the context menu as a new submenu, Colorize Tracks.

I probably should play with the colormaps and use something smarter than a simple blue-to-red gradient, but even as it is, it's fun to look at a hike to Nambe Lake colorized by altitude (first image) or a mountain bike ride along Potrillo Mesa and the Boundary Trail colorized by speed (second image).

The code is on GitHub, in this commit.

Again, that's for the challenge two days ago. Today's Map Challenge is "A Bad Map". No promises that I'll have time for another mapping project today ... but I'm looking forward to seeing what other people come up with.

Tags: mapping, GIS, 30 day map challenge, pytopo
[ 12:28 Nov 04, 2023    More mapping | permalink to this entry | ]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK