# GPX Splitter

Split a GPX track into multiple segments by distance, elapsed time, or detected stop gaps. Output a new GPX or a per-segment summary locally in your browser.

## Run it

- **CLI:** `gizza tool gpx-split '<gpx><trk><name>Ride</name><trkseg><trkpt lat="0" lon="0"/><trkpt lat="0.01" lon="0"/></trkseg></trk></gpx>'`
- **Web:** https://gizza.ai/tools/gpx-split/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/gpx-split/tool.json

## Inputs

- `gpx` — GPX XML _(field)_
- `mode` — Split mode _(field)_
- `distance` — Distance per segment _(field)_
- `unit` — Distance unit _(field)_
- `time_min` — Minutes per segment _(field)_
- `stop_gap_s` — Stop gap seconds _(field)_
- `output` — Output _(field)_

## Output

- Split GPX / summary (text)

## Query parameters

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

- `gpx` — GPX XML
- `mode` — Split mode
- `distance` — Distance per segment
- `unit` — Distance unit
- `time_min` — Minutes per segment
- `stop_gap_s` — Stop gap seconds
- `output` — Output

Example: `https://gizza.ai/tools/gpx-split/?gpx=%3Cgpx%3E%3Ctrk%3E%3Cname%3ERide%3C%2Fname%3E%3Ctrkseg%3E%3Ctrkpt%20lat%3D%220%22%20lon%3D%220%22%2F%3E%3Ctrkpt%20lat%3D%220.01%22%20lon%3D%220%22%2F%3E%3C%2Ftrkseg%3E%3C%2Ftrk%3E%3C%2Fgpx%3E&mode=distance&distance=5&unit=km&time_min=30&stop_gap_s=120&output=gpx`

---

## What this tool does

Paste a GPX track and split it into smaller segments. Choose **distance** to cut
after a target length, **time** to cut after an elapsed duration, or **stops** to
start a new segment when there is a large timestamp gap between points. The tool
can output a fresh GPX document with one track per segment, or a text summary of
distance, duration, and point counts.

Everything runs locally in WebAssembly. No map service or upload is required.

## Worked example

With `mode=stops`, `stop_gap_s=120`, and `output=summary`, a track with a
20-minute pause produces two segments:

```text
Split into 2 segments (stops, on gaps over 120 s).

Segment 1: 0.11 km (0.07 mi), 2 points, 0:01:00  [2024-01-01T00:00:00Z → 2024-01-01T00:01:00Z]
Segment 2: 0.11 km (0.07 mi), 2 points, 0:01:00  [2024-01-01T00:21:00Z → 2024-01-01T00:22:00Z]
```

Switch `output` to `gpx` when you want a copyable GPX file with tracks named
`Original name - Part 1`, `Original name - Part 2`, and so on.

## Limits and edge cases

- Time and stop modes require parseable GPX `<time>` values on track points.
- Distances use great-circle haversine distance between consecutive points.
- Distance/time splits duplicate the boundary point so segments remain
  geometrically contiguous; stop splits leave the real recording gap.
- The output preserves latitude, longitude, elevation, and timestamp values, but
  GPX extensions such as heart rate, cadence, or power are not retained.
- This is deterministic text processing; there is no interactive map preview or
  click-to-split UI.

## FAQ

<details>
<summary>Does this upload my route?</summary>

No. The GPX parser and splitter run locally in your browser. The tool does not
call a map API or send your track to a server.

</details>

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

Use `distance` for equal-length chunks, `time` for workout intervals or elapsed
duration chunks, and `stops` when your recorder paused for breaks and you want
each continuous movement section separated.

</details>

<details>
<summary>Why did time or stops mode fail?</summary>

Those modes need timestamps on the GPX points. If your file has coordinates but
no `<time>` elements, use distance mode instead.

</details>

<details>
<summary>Are sensor extensions preserved?</summary>

No. The generated GPX keeps coordinates, elevation, and timestamps. Extra
extensions such as heart rate, cadence, power, or app-specific metadata are
dropped in this version.

</details>

## Related tools

- [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.
- [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.
- [CAMT.053 Statement Parser](https://gizza.ai/tools/camt053-parse/): Parse a camt.053 (or camt.052/054) ISO 20022 bank statement XML into JSON or CSV in your browser: balances, dates, counterparties, references. No upload.
- [Find CSV rows with no matching key](https://gizza.ai/tools/csv-anti-join/): Return rows in CSV A whose key has no match in CSV B, or the reverse, with composite keys, alternate delimiters, and browser-local processing.
- [CSV Cell Diff](https://gizza.ai/tools/csv-cell-diff/): Compare two CSVs column-by-column and highlight every individual cell that changed, plus added and removed rows and columns.
