jimmykane / quantified-self

Compare files from various activity trackers
GNU Affero General Public License v3.0
197 stars 25 forks source link

Feature Request: Apply DEM (Elevation Model) Data to Track #268

Open dbrgn opened 2 years ago

dbrgn commented 2 years ago

Hi, first of all thanks for developing this tool!

I have a lot of tracks recorded with my phone (OsmAnd) which contain some bad datapoints. The elevation profile then looks like this:

screenshot-20220214-095653

This is a track from a hike, and for a human, it's obvious what the issue is. Those "outlier points" need to be removed, and replaced with interpolated points. If this is not done, track statistics may be very wrong (e.g. total ascent).

However, smoothing algorithms won't work here if they use averaging, because the outliers will pull up / down the entire track. What helps is mapping the trackpoints to a DEM (digital elevation model). Essentially you take every trackpoint, look up the elevation in the model, and overwrite the previous elevatoin. This can be done for example with GPS Visualizer: https://www.gpsvisualizer.com/elevation After running the GPX file through that tool, the profile looks like this, the "holes" are gone:

screenshot-20220214-095938

Strava does this as well when uploading a track, however their DEM is crappy for mountaineous areas. When I go on a hike or mountaineering tour, Strava regularly thinks the peaks are 50m or more lower than they actually are, because they use a very coarse elevation profile that misses small peaks.

Would it be possible to integrate some DEM sources into quantified-self, so that tracks can be fixed directly in the UI? From a quick online search, I found this page:

https://gisgeography.com/free-global-dem-data-sources/

For Switzerland, there's also this freely available, high-precision DEM: https://www.swisstopo.admin.ch/en/geodata/height/alti3d.html

An ideal implementation could deal with multiple DEM data sources, and would automatically pick the most detailed one available.