Geographic Information Systems Asked by Benzo on March 22, 2021
I’m looking for a way to apply spline interpolation to a gps track (GPX format). I am a regular QGIS user and also have GDAL libraries installed on my Mac if that helps.
Basically trail and ride information on MTB Project has a small set of points and actual paths are expanded via spline interpolation to reduce file sizes. I can download the tracks in gpx format, but they only contain a small set of points, giving me a track which resembles a jagged line which represents the small amount of points before interpolation. I want to apply a similar transformation to re-create the curved lines that are on the website, in a somewhat repeatable process that doesn’t have me manually re-tracing each point with the spline drawing tool in QGIS.
Does anyone know of a way that I can easily apply spline interpolation to my gps track data to reproduce the splined track from MTB Project using free tools? Preferably on OSX?
Try using v.generalize
tool from the Processing Toolbox. There are a number of algorithms in there that can generalize a line nicely.
Another possible solution could be the "Generalizer" plugin which was mentioned in this post, the plugin info in QGIS suggests that the tool is based on the v.generalizer Grass module anyway.
Just for reference below is an example of the output from the v.generalize tool. I used the default inputs for both the Chaiken and Hermite outputs, I have no doubt you could receive better results with a bit of research into the tool and specifically what the input values mean.
Update - The Snakes algorithm (not show in the orginal image below) with some tweaking of the alpha and beta parameters gives a smoother appearance on my test dataset.
References:
Answered by Andrew Jeffrey on March 22, 2021
I feel awkward, but let me recommend QGIS + Spline Plugin as one of the options for your case.
If your Tightness is set to 0.5 (default value), it can connect dense measurement points smoothly, and higher Tightness tries not to bend the curve at around those points.
You will notice Blue curve (0.9) fits better at gentle curve, and Orange (0.5) is good for tight corners. This flexibility is the best part of manually digitizing by Spline Plugin. If we try to do it by math equation, it can be nightmare.
Answered by Kazuhito on March 22, 2021
There is a python script "gpx_interpolate" on Github which will do interpolation between GPX track points.
python3 gpx_interpolate.py -r 50 -d 3 INPUT.gpx
This will output a new file INPUT_interpolated.gpx with 50m (-r 50
) between points and along spline of degree 3 (-d 3
).
Options:
-r
: distance between interpolated points. Default is 1m (change this if you have a long tracklog or you'll end up with a long wait and huge output file);-d
: polynomial degree starting from 1 (straight lines) then up to degree 5 (2-5 all curves).-n
: force a certain number of output points (default is 0, no limit).I've been using this to produce better estimates of actual tracks from aircraft flight logs where the GPS was set to a 10-second interval. In the example above setting resolution r to 50 interpolated an approximately 1-second interval which matches closely the real track. This is really helpful when using a low-res GPS track to correctly georeference images taken in flight.
Note that this script doesn't preserve the original trackpoints, but it is possible to merge the originals with the new interpolation using gpsbabel:
gpsbabel -i gpx -f INPUT.gpx -f INPUT_interpolated.gpx -x track,merge -o gpx -F INPUT_merged.gpx
Answered by Simbamangu on March 22, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP