Recently, I have started to collect data from GPS during bicycle commutes using an Android smartphone. This job is done by MyTracks. I have tried other applications, but this one worked out best.
MyTracks, by default, creates a kmz file, which is a Keyhole Markup Language (kml) file (or various) bundled with other resources into a zip file. It can export to other types, but kmz has some advantages, like photographs embedded on markers.
Loading this file in Google Maps directly from Google Drive was straightforward, but it requires an internet connection. I wanted to view, and maybe edit, the file offline. I have tried loading the kmz file directly on various applications under Linux, but the I have only achieved getting the begin and end points this way.
So, I converted the kmz file to gpx (GPS Exchange Format) using gpsbabel and the track was correctly imported (I am using JOSM - Java OpenStreetMap on the computer).
How to Convert
Given a kmz file, to get a gpx one:
$ unzip -p myfile.kmz doc.kml | gpsbabel -i kml -f - -o gpx -F myfile.gpx
myfile.kmz
is the file to be converted. gpsbabel does not convert
kmz directly to gpx, so it is necessary to extract the kml
file that inside kmz (which is doc.kml
in the example). The file
is piped to gpsbabel which will save the new gpx file myfile.gpx
.
If there is more than one kml file, the processes must be
repeated for every kml.
External Links
- gpsbabel (accessed 2014-02-20): project website;
- kml (accessed 2014-02-20): Keyhole Markup Language file type;
- gpx (accessed 2014-02-20): GPS Exchange Format file type.
Revision History
Post built on: 2014-02-21 00:00:18
Last modified on: 2014-02-21 00:00:13
First published on: 2014-01-21
Revision | Date | Description |
---|---|---|
1.00 | 2014-02-21 | Initial Version. Published. |
Hello. Have you heard of http://kml2gpx.com/. This free online tool converts kml extension into gpx format plus the other way around, which may be also useful for your situation. See how it works, maybe it can help you.
ReplyDeleteSuper useful. Used this to convert mymaps.google.com created maps to export .kmz, convert to .gpx and copy into Android/data/net.osmand/files/tracks to get the places in OsmAnd with offline openstreetmaps :)
ReplyDeleteThanks for the tip. I needed to convert a Google Earth kml file to gpx for submitting geocache coordinates.
ReplyDeleteI cleaned it up and wrapped it into a bash function. The quotes allow handling filenames containing spaces.
function kmltogpx() { unzip -p "$1" doc.kml | gpsbabel -i kml -f - -o gpx -F "${1%.*}.gpx"; }
Respect and that i have a super offer you: What Home Renovation Expenses Are Tax Deductible updating exterior of home
ReplyDeleteRespect and that i have a dandy give: How Many Houses Has Hometown Renovated for home renovation
ReplyDelete