# GPX to KML Converter

Convert GPX tracks, routes, and waypoints into KML for Google Earth. Set line color, width, opacity, waypoint color, and altitude mode locally.

## Run it

- **CLI:** `gizza tool gpx-to-kml "<gpx version='1.1'><trk><name>Morning Run</name><trkseg><trkpt lat='52.100' lon='5.100'><ele>10</ele></trkpt><trkpt lat='52.101' lon='5.102'><ele>12</ele></trkpt></trkseg></trk></gpx>"`
- **Web:** https://gizza.ai/tools/gpx-to-kml/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/gpx-to-kml/tool.json

## Inputs

- `gpx` — GPX XML _(field)_
- `line_color` — Track/route line color _(field)_
- `line_width` — Line width (px) _(field)_
- `line_opacity` — Line opacity (%) _(field)_
- `waypoint_color` — Waypoint icon color _(field)_
- `altitude_mode` — Altitude mode _(field)_
- `document_name` — Document name (optional) _(field)_

## Output

- KML (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `gpx` — GPX XML
- `line_color` — Track/route line color
- `line_width` — Line width (px)
- `line_opacity` — Line opacity (%)
- `waypoint_color` — Waypoint icon color
- `altitude_mode` — Altitude mode
- `document_name` — Document name (optional)

Example: `https://gizza.ai/tools/gpx-to-kml/?gpx=%3Cgpx%20version%3D%271.1%27%3E%3Ctrk%3E%3Cname%3EMorning%20Run%3C%2Fname%3E%3Ctrkseg%3E%3Ctrkpt%20lat%3D%2752.100%27%20lon%3D%275.100%27%3E%3Cele%3E10%3C%2Fele%3E%3C%2Ftrkpt%3E%3Ctrkpt%20lat%3D%2752.101%27%20lon%3D%275.102%27%3E%3Cele%3E12%3C%2Fele%3E%3C%2Ftrkpt%3E%3C%2Ftrkseg%3E%3C%2Ftrk%3E%3C%2Fgpx%3E&line_color=%23ef4444&line_width=4&line_opacity=80&waypoint_color=%233b82f6&altitude_mode=clamp_to_ground&document_name=Falls%20back%20to%20the%20GPX%20metadata%20name`

---

## About this tool

Paste GPX XML and get a KML 2.2 document that opens in Google Earth and other KML-aware viewers. Tracks and routes become LineString placemarks, waypoints become Point placemarks, and the converter keeps useful metadata such as names, descriptions, timestamps, and elevation when those fields are present.

Use the styling controls to set the track/route line color, line width, line opacity, and waypoint icon color before exporting. The altitude mode controls how Google Earth interprets elevation values: clamp to ground for normal map overlays, absolute for 3D paths with sea-level altitude, or relative to ground for heights above terrain.

### Worked example

Input:

```xml
<gpx version="1.1">
  <metadata><name>Trip</name></metadata>
  <trk><name>Morning Run</name><trkseg>
    <trkpt lat="52.100" lon="5.100"><ele>10</ele></trkpt>
    <trkpt lat="52.101" lon="5.102"><ele>12</ele></trkpt>
  </trkseg></trk>
</gpx>
```

With the default red line, width 4, 80% opacity, and clamp-to-ground altitude mode, the output includes a KML `<Document>` named `Trip`, a shared `<LineStyle>` color of `cc4444ef`, and a `<LineString>` with coordinates `5.1,52.1,10 5.102,52.101,12`.

### Limits and edge cases

- The tool converts one GPX document at a time and returns plain KML text, not KMZ zip files.
- It reads standard `<trk>`, `<rte>`, and `<wpt>` elements. Vendor extension data is ignored so the output stays portable.
- KML colors use `aabbggrr` byte order; this tool converts from familiar CSS `#RRGGBB` and `#RGB` inputs for you.
- Empty documents or GPX files with no track, route, or waypoint return a clear error instead of an empty KML file.

## FAQ

<details>
<summary>Does this preserve tracks, routes, and waypoints?</summary>

Yes. GPX tracks (`trk`) and routes (`rte`) become KML LineString placemarks, while GPX waypoints (`wpt`) become Point placemarks. Names and descriptions are copied when the GPX file provides them.

</details>

<details>
<summary>Which altitude mode should I choose?</summary>

Use clamp to ground for normal map overlays. Choose absolute if the GPX elevation is metres above sea level and you want a 3D path. Choose relative to ground when the elevation values represent height above terrain.

</details>

<details>
<summary>Can this tool create KMZ files?</summary>

No. It returns standard KML text so you can inspect or save it directly. KMZ is a zipped KML package; if you need one, save the output as `.kml` first and package it separately.

</details>

<details>
<summary>Why do KML colors look different from CSS hex colors?</summary>

KML stores colors as `aabbggrr`: alpha first, then blue, green, and red. The form accepts CSS-style `#RRGGBB` or `#RGB` colors and converts them to the KML byte order automatically.

</details>

## Related tools

- [GPX / KML to GeoJSON Converter](https://gizza.ai/tools/gpx-to-geojson/): Convert GPX or KML GPS tracks and waypoints into GeoJSON, or GeoJSON back into GPX, entirely in your browser. Free, private, no upload.
- [Amazon Order Analyzer](https://gizza.ai/tools/amazon-order-analyzer/): Paste an Amazon order-history CSV export to summarize total spend by month, top items, and category breakdowns. Browser-only, private, with Markdown or JSON output.
- [Avro to JSON Converter](https://gizza.ai/tools/avro-to-json/): Decode Apache Avro Object Container Files (.avro / OCF) to JSON, NDJSON, or the embedded schema — no .avsc needed, free and private in your browser.
- [Reconcile bank statement and ledger CSVs](https://gizza.ai/tools/bank-statement-reconcile/): Match bank-statement CSV rows to ledger rows by date, signed amount, and fuzzy memo similarity, with unmatched and suggested matches.
- [Bencode decoder](https://gizza.ai/tools/bencode-decoder/): Decode bencode (the BitTorrent / .torrent serialization format) into readable JSON, and re-encode JSON back into canonical bencode — in your browser. Nothing is uploaded.
