12. January 2014

How to convert Geocaching GPX file to WPT for OziExplorer

The goal is simple: convert GPX file from Geocaching.com to WPT file for Ozi Explorer and keep correct encoding of Slovak, Czech and German special characters.
Install GPSBabel and iconv. Store following script to file convert-gpx2wpt:

#!/bin/bash

if [ -z "$2" ]; then
    echo "Specify input and output file"
    exit 1
fi

INPUT_FILE="$1"
TEMP_FILE="$1-cp1250"
OUTPUT_FILE="$2"

iconv -c -f utf8 -t cp1250 < "$INPUT_FILE" > "$TEMP_FILE"
gpsbabel -i gpx -f "$INPUT_FILE" -o ozi,pack -F "$OUTPUT_FILE"

How to use:

chmod a+x convert-gpx2wpt
./convert-gpx2wpt input-file.gpx output-file.wpt

More info: http://www.gpsbabel.org/htmldoc-1.4.4/fmt_ozi.html

You can also use online service for conversion (there is limit on file size): http://www.gpsvisualizer.com/gpsbabel/