Today I wanted to geo-code some of my photos.
I have an SLR digital camera (no gps of course), and an android phone. I recorded a track with My Tracks from google on the phone. (Not entirely recommended but works). I then fired up digikam to run the geo-correlation and add lat-long to the exif of the files only to discover digikam doesnβt know how to read kml. Fooey.
I looked to gpsbabel, but it apparently canβt handle this style of kml file, as differentiated by the coordinates being in the following style of markup:
<gx:Track>
<when>2014-01-25T18:00:13.955Z</when>
<gx:coord>-1.885348 50.769434</gx:coord>
<when>2014-01-25T18:00:14.565Z</when>
<gx:coord>-1.885193 50.769328 53.20000076293945</gx:coord>
<when>2014-01-25T18:00:58.566Z</when>
So I wrote a python script to munge it into gpx shape:
This can be run as follows:
./kmlToGpx.py "25-01 12-48.kml" > "25-01 12-48.kml.gpx"
And worked a treat for me.
After Iβd done this I discovered my pet tool gpsprune can open the new style kml. (I forked gpsprune a while ago and added a minor feature) However Iβm glad to have a command-line tool as I have hundreds of tracks I want to convert.
Incidentally the phone can automatically sync the tracks to google drive, which is kinda handy and then you can download them from the site etc.