Two formats for the same places
KML is Google Earth’s format: placemarks holding points, lines and polygons, often grouped in folders. GPX is the format GPS devices and sports apps exchange: waypoints, routes and tracks made of timed points. Both are XML. When you convert KML to GPX, every placemark is read wherever it sits in folders; when you convert GPX to KML, each waypoint, route and track becomes a placemark.
How things map
- Points — a KML Point placemark becomes a GPX
wpt, and back. The placemark name, description and TimeStamp go toname,descandtime; the altitude toele. - Lines — a KML LineString becomes a track (
trk,trkseg,trkpt); several lines in one MultiGeometry become segments of one track. A GPX track becomes a LineString placemark, or a MultiGeometry for several segments; a GPX route (rte) also becomes a LineString. - Timed tracks — Google Earth’s
gx:Track, which stores a time for every point, is read into track points with times. Going from GPX to KML, a plain LineString cannot store per-point times; turn on “Keep track point times” to writegx:Trackinstead. Becausegx:Trackneeds an altitude for every point, points without an elevation get 0, and a note says how many. - Polygons — GPX has no areas, so a polygon’s outer edge is written as a closed track, with a note.
What is not carried over
Styles (line colours, icons), KML network links, image overlays and 3D models have nowhere to go in GPX, and GPX extensions such as heart rate or cadence have nowhere to go in KML. Anything left out is named in a note above the result. GPX times must include a time of day, so a KML TimeStamp that is only a date or a month is dropped, with a note. The KML written does not set an altitude mode, so Google Earth draws it on the ground; the altitudes are still kept in the coordinates.
KMZ files and shapefiles
A KMZ file is a KML file zipped together with its icons and images. This tool does not unzip it: rename the .kmz to .zip, extract it, and open the doc.kml inside. Shapefiles (.shp) and GeoJSON are other formats again and are out of scope here.