What I said on 27 Jan 2012

12 tweets on 27 Jan 2012:

Posted in Twitter | Tagged | Leave a comment

What I said on 26 Jan 2012

13 tweets on 26 Jan 2012:

Posted in Twitter | Tagged | Leave a comment

What I said on 25 Jan 2012

12 tweets on 25 Jan 2012:

Posted in Twitter | Tagged | Leave a comment

What I said on 24 Jan 2012

6 tweets on 24 Jan 2012:

Posted in Twitter | Tagged | Leave a comment

Convert tracks into routes with GPSBabel

Last week, I blogged about creating routes for a Garmin Zümo, using Google Maps and GPSBabel. The main problem that I was trying to solve, is how to create a “real” route that my Zümo will understand, built out of a minimal amount of route waypoints (that show up as such on the Zümo when navigating), rather than possibly thousands of trackpoints, that are hard to process for the device and don’t give you as much navigation flexibility.

This post is about something else, namely how to convert a GPS track (that you created by driving, downloaded somewhere, etc.) into a route, with the same criteria as last time.

Suppose you have a GPX file, containing a track. Typically, such a track contains many trackpoints. For example, a drive of about 60 km that I took a few weeks back, gave me a track consisting of over 2600 trackpoints. Now, I would like to create a route out of this track, that I can share with others.

I don’t know about you, but in my case, a track always contains some stuff that I don’t want to show up in the end result: mistakes that I made during my ride, like entering dead-end streets, or those extra meters that you make, looking for a place to park for a coffee break. Stuff like that is easily corrected with Viking, a nice GPS/track/waypoint editor, that runs on Linux (POSIX) and Windows, and is available under the GPL v2 license. Maybe later I will post something on using Viking, but that’s besides the scope of this post. Let me continue.

So, now I have a GPX, containing the exact track that I want turned into a route. We will use GPSBabel to do the conversion. The invocation is similar to the one in my previous post, but instead of using waypoints, we convert a track into a route, and we add a filter: simplify. I quote:

The Simplify filter is used to simplify routes and tracks for use with formats that limit the number of points they can contain or just to reduce the complexity of a route.

And that is exactly what we need. Simplify will let you specify a maximum number of waypoints in a route, but we will use another feature: maximum error. It allows us (and again, I quote) to specify the maximum allowable error that may be introduced by removing a single point. That means that the nuber of waypoints can be higher on more complex pieces of our route, and lower on the long stretches.

Here we go:

gpsbabel -i gpx -o gpx -f track.gpx -x transform,rte=trk -x nuketypes,waypoints,tracks -x simplify,error=0.1k -F route.gpx

By specifying a maximum error of 0.1k (0.1 km, or 100 m), our original track file, containing a track of 62.84 km in 2641 trackpoints, is converted in to a route file, containing 73 route waypoints.

In the picture, you can see the result. Click to enlarge. In orange is the original track; in green is the resulting route, with dots on the route waypoints. The map is left out for clarity.

I think that this gives us a route, that has enough waypoints not to leave much room for interpretation by the routing engine of a GPS device. My guess is, that most routing engines will calculate identical routes, regardless of your routing parameters, like shortest/quickest route. I haven’t tested this, though.

It speaks for itself, that a higher value for ‘error’ will give you less waypoints, and a lower value will give you more. For example, using ‘error=0.05k’ (50 m), gives me 109 route waypoints. If this is still acceptable, you can profit from the greater accuracy of your route.

Google maps

Now, the funny thing is, that this can also be applied to tracks from Google Maps’ KML files. Please have a look at this post. So if you want to skip the labour-intensive step of creating placemarks for all your route waypoints, you can use the track instead.

The GPSBabel invocation becomes:

gpsbabel -i kml -o gpx -f Routetest.kml -x transform,rte=trk -x nuketypes,waypoints,tracks -x simplify,error=0.5k -F Routetest.gpx

Meaning:

  • Convert KML into GPS
  • Convert the track into a route
  • Remove as many waypoints as possible, creating maximum error of 500 meters
  • Remove tracks and waypoints from the resulting GPX, keeping only the route

With the KML file from my example (a route of some 590 km through some of the best parts of France), this will result in a route, made out of 179 route waypoints, which should be fine for a Garmin Zümo.

Drawback

There is one drawback when using the track from Google as input for a route for -for example- a Garmin device. The waypoints that remain after the conversion are the result of a mathematical algorithm, and their position on the map is absolute. This means, that if there are differences between Google’s map and Garmin’s (and there are!), it can happen, that a route waypoint ends up in an unfortunate location. For example, the waypoint could end up on the other side of the highway, where traffic drives in the opposite direction.

Since the remaining waypoints will be concentrated around crossroads and curves, it is in fact quite likely that at least a few of these problems will occur.

The route on the Garmin might end up with strange loops as a result. Therefore, it is pretty essential to check the final result, either in MapSource or on your GPS device, to prevent unpleasant surprises.

Posted in Nerd Stuff | Tagged , , , , , , | Leave a comment

A photograph

20110925174734_IMG_7245

 
Our cat. It’s an older picture (Sep 2011), that I just found lingering on my laptop somewhere.

Posted in Photography | Tagged | Leave a comment

What I said on 23 Jan 2012

11 tweets on 23 Jan 2012:

Posted in Twitter | Tagged | Leave a comment

What I said on 22 Jan 2012

1 tweets on 22 Jan 2012:

  • Waarom kan ik Google Picasa voor Windows niet downloaden op een Linux werkstation? "Picasa is not currently available for your OS". Einde. 12:16:58
Posted in Twitter | Tagged | Leave a comment

Digikam 2.5 on Ubuntu Natty

Ubuntu Natty Narwhal (11.04) is almost a year old, but if you, like me, are not brave enough to upgrade to Oneiric, sometimes you find yourself forced to use outdated software. Fortunately, for many programs, backports from newer Ubuntu releases are available. Today, I am trying to install DigiKam 2.5.

A DigiKam backport is available from Philip Johnsson’s kubuntu-backports PPA. However, it is built for KDE 4.7, while Natty’s KDE is still at 4.6. So, we upgrade, using the Kubuntu Backports PPA. Now we’re almost there, except for some dependencies of DigiKam, that are not available in either PPA. These can be found in Philip Johnssons ‘extra’ PPA, but we have to be careful, because this PPA contains a lot of packages, and we surely do not want to upgrade all of those.

So, here we go. First, add the necessary PPAs:

sudo apt-add-repository ppa:kubuntu-ppa/backports
sudo apt-add-repository ppa:philip5/kubuntu-backports
sudo apt-add-repository ppa:philip5/extra

Then, make sure we don’t upgrade to packages from philip5/extra by default. Add the following to /etc/apt/preferences:

Package: *
Pin: release o=LP-PPA-philip5-extra
Pin-Priority: 1

Now you can just upgrade your system:

sudo apt-get update && sudo apt-get dist-upgrade

or use aptitude so review what will happen before you go ahead.

Posted in Nerd Stuff, Photography | Tagged , , , , , | Leave a comment

What I said on 21 Jan 2012

8 tweets on 21 Jan 2012:

Posted in Twitter | Tagged | Leave a comment