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.

enter image description here

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?

  • FWIW, topofusion has this feature that I'm looking for, but I'm a mac user. So I'm looking for something that will work without Windows. topofusion.com/spline.php – Benzo Dec 31 '16 at 19:57
  • Actually, I used a windows pc and found topofusion does an okay job of smoothing the lines, but they are not interpolated in the same way as MTB project, so sometimes the curves happen in a way that is dissimilar and causes tracks to be even less accurate instead of more accurate, even after tweaking the parameters. – Benzo Jan 11 '17 at 15:41

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.

Example of v.generalize output

| improve this answer | |

I feel awkward, but let me recommend QGIS + Spline Plugin as one of the options for your case.

  1. Yes, digitizing all points is cumbersome. But setting an appropriate Snap Option parameter can lessen a burden of the task.
  2. Other software capable to create Splines would be CAD (e.g. AutoCAD) or mathematical solution (e.g. R). If you choose CAD, its workflow is almost same, to repeat clicking points to add spline segments.
  3. If the bicycle track was an "ideal" spline curve, mathematically interpolated, best fit spline will be the solution. In reality, such spline rarely represents whole your track. You may end up splicing several curves, by attempting various smoothing parameters.
  4. When you use Spline Plugin, you can change parameters as you progress digitizing.

enter image description here

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.

  1. I am afraid generalize technique does not honor original data points. In other words, curve derived by generalizer does not go through your bicycle track.
| improve this answer | |
  • Thanks for the point about the generalize technique, good to know. I'm probably not going to use the spline plugin option, as I'm trying to set parameters and run this process on multiple tracks, so this won't be a one off operation. I need a quickly repeatable process. – Benzo Jan 9 '17 at 19:43
  • Not accepting this as the answer, but awarding bounty for closest solution. Maybe if I take the time to figure out how to hack the spline plugin since I know some python, I can get it to iterate over the existing points automatically instead of doing manual digitization. Not sure how difficult that would be, but the source is out there for the plugin. – Benzo Jan 12 '17 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.