Pages

Wednesday, August 19, 2009

Converting GPX tracks to Google's kml format

Earlier this year I bought a neat GPS tracker for recording hiking trips and geotag my photos. With the software provided I can export these tracks to the GPX format which is an XML format for describing waypoint, tracks and routes. But for displaying my tracks in Google Earth, I need the kml format, which is also an XML format. For the transformation I use the free tool GPSBabel and a small batch script for convenient conversion.


@echo off
setlocal
if "%2"=="" (set out="%~n1.kml") else (set out=%2)
echo gpsbabel -i gpx -f %1 -o kml -F %out%
gpsbabel -i gpx -f %1 -o kml -F %out%
endlocal


The script could easily modified for the backward conversion (kml to gpx)