GPX vs KML
Use GPX to move a track or a route between GPS apps and devices. Use KML to show places, lines and areas in Google Earth or on a map, with your own colours and icons.
Open either format in the GPX viewer or the KML viewer. It runs in your browser, and the file never leaves your device.
What GPX and KML files can store
| Data | GPX | KML |
|---|---|---|
| Recorded tracks | Yes | Yes |
| More than one track | Yes | Yes |
| Track segments | Yes | YesAs a MultiGeometry |
| Planned routes | Yes | YesWritten as lines, read back as tracks |
| Waypoints | Yes | YesAs Point placemarks |
| File name and title | Yes | Yes |
| Description | Yes | Yes |
| Author | Yes | No |
| Creation time | Yes | No |
| Links | Yes | No |
| Track names | Yes | Yes |
| Activity type | Yes | No |
| Elevation | Yes | Yes |
| Timestamps | Yes | YesOnly in gx:Track |
| Heart rate | With an extensionGarmin TrackPointExtension | With an extensionExtendedData in gx:Track |
| Cadence | With an extensionGarmin TrackPointExtension | With an extensionExtendedData in gx:Track |
| Power | With an extensionGarmin PowerExtension, not read by every app | With an extensionExtendedData in gx:Track |
| Temperature | With an extensionGarmin TrackPointExtension | With an extensionExtendedData in gx:Track |
| Speed | With an extensionGarmin TrackPointExtension v2 | With an extensionExtendedData in gx:Track |
This table comes from the code of TrackLoupe, and the notes say how each field is stored. The converters use the same table to tell you what a conversion keeps and what it loses.
The main differences
| Difference | GPX | KML |
|---|---|---|
| Made for | Exchanging GPS data between apps and devices | Showing geographic data in Google Earth and maps |
| Coordinates | Latitude and longitude as attributes | Longitude, latitude and altitude in one text |
| Times | On every point of a track | Only in a gx:Track |
| Styles | None | Colours, line widths and icons |
| Areas | None | Polygons |
| Google Earth | Not imported by the web version | Imported directly |
| Zipped version | None | KMZ |
Both are XML text, and both store elevation in metres.
When to use GPX
- To load a route or a track on a GPS device or a sports watch.
- To move a recording from one app to another.
- When the time of each point matters, for example to measure speed or moving time.
When to use KML
- To open the data in Google Earth. Google Earth on the web imports KML and KMZ, and Google’s documentation says to convert GPX files to KML first.
- To style the map with colours, icons, labels and areas.
- To share places with descriptions. A KMZ can also carry the photos.
Converting between GPX and KML
The table above shows what survives in each direction. A few points need care:
- A GPX track keeps its times in KML only as a
gx:Track. A plain KML line has no times. - KML styles, polygons and network links have no place in GPX, so a conversion leaves them out.
- GPX routes become KML lines, and they come back from KML as tracks, because KML has no separate idea of a route.
Questions
Can Google Earth open a GPX file?
Google Earth on the web imports KML, KMZ, GeoJSON and shapefiles. For GPX files, Google’s documentation says to convert them to KML or CSV first.
Which one does Google My Maps accept?
Both. My Maps imports GPX files up to 40 MB and KML files up to 5 MB.
Do both formats store elevation?
Yes. GPX stores it in the <ele> element of each point, and KML as the third value of each coordinate.
Where can I open both?
The GPX viewer and the KML viewer open GPX, KML and KMZ files in your browser, without uploading them.