BaseCamp GPX route cleaner

If you create a route in base camp and export it in the GPX format, many additional waypoints are stored in an file extension in addition to the one created by you. These should help the navigation system to use the same route you created on the pc, but in my experience those tend to create trouble (errors like unable to recompute a route while driving).

To avoid these problems I removed these waypoints by importing the route into QLandkarte GT and export it thereafter. Unfortunately some information is lost:

  • Name of the waypoint
  • If the waypoint should be displayed or is only there to assist the routing
  • Used Icon

Since the information loos and the invocation of a second program was annoying I created a sed command to remove only these additional waypoints:

sed -n '1h 
        # if the sought-after regex is not found, append the pattern space to hold space
        /        <gpxx:RoutePointExtension>.*<\/gpxx:RoutePointExtension>/ !H
        # copy hold space into pattern space
        # if the regex is found, then...
        /        <gpxx:RoutePointExtension>.*<\/gpxx:RoutePointExtension>/ {
                # the regular expression
                s/        <gpxx:RoutePointExtension>.*<\/gpxx:RoutePointExtension>//g
                # print 
                # read the next line into the pattern space
                # copy the pattern space into the hold space
        # copy pattern buffer into hold buffer
# if the last line then print
' input.GPX > output.GPX 

For convenience I put it in an Automator-programm that supports Drag&Drop. I can be downloaded here.

Dieser Beitrag wurde unter Allgemein abgelegt und mit , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.