> ## Documentation Index
> Fetch the complete documentation index at: https://rendzo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Reroute

> Snap an imported or recorded GPX track to actual roads and trails — clean up jitter, fix off-road detours, or road-snap a recorded ride.

<Note>
  Reroute is a **Pro** feature. Starter plan users will see the tool in the toolbar with an upgrade prompt — visit your [Account](/app/account) page to upgrade.
</Note>

<Warning>
  This tool is currently **Experimental**. It works well for most cases, but Map Matching can produce unexpected results on undefined dirt roads, parallel tracks, and sparse trackpoints. See [Troubleshooting](#troubleshooting).
</Warning>

The Reroute tool fixes one of the most common problems with imported tracks: lines that wander off the road, take weird detours, or have visible GPS jitter. It rewrites your track so it follows actual roads and trails — without ever touching the original file.

## When to Use It

* You **imported a GPX from another app** and the line cuts corners or goes off-road in places.
* You **recorded a ride** with a watch or cycling computer, and GPS jitter makes the file too noisy.
* You have a **planned route that needs a clean line for sharing** — the current route shape is "close," but you want it locked onto roads.
* The file has a **stray waypoint that produces a visible dogleg** — a single bad point is pulling the routing off course.

If your line already looks good and follows real roads, you probably don't need this tool.

## Choose a Mode

When you open Reroute, the first thing you'll see is a checkbox: **"Preserve original trackpoints"**.

|                                 | Off (Routing mode)                                                                                                            | On (Preserve trackpoints mode)                                                                  |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| **What it does**                | Picks anchor points along your track, then **routes** between them along roads. Produces a clean new line that follows roads. | Keeps **every** original trackpoint, just **snaps** each one to the nearest road.               |
| **Output**                      | Brand new track geometry. Number of points depends on the Detail slider.                                                      | Same number of points as your source (minus any that couldn't be snapped to a road).            |
| **Time / HR / cadence / power** | **Lost** — new points are generated by the router with no extension data.                                                     | **Preserved** — each point keeps its original timestamp, elevation, and all extensions intact.  |
| **Best for**                    | Plotted routes, GPX imports from other apps, planned trips you want cleaned up.                                               | Real GPS recordings where you want to keep the time / sensor data but tidy the path onto roads. |

<Tip>
  If the file came from a watch or cycling computer and the time data matters, use **Preserve mode**. If it's a plotted route and you want a tidy road-snapped line, use **Routing mode**.
</Tip>

## Routing Mode (Step-by-Step)

1. **Select a track** in the [File Tree](/app/file-tree).
2. **Adjust Density** to control how many anchor points the tool extracts. The label shows e.g. `925 / 8,181 anchors`. More anchors = tighter match to your original line. Fewer anchors = faster, but the router has more freedom to deviate.
3. **Pick a Profile** that matches the activity (Cycling, Hiking, Car, etc.). This decides which roads and trails the router is allowed to use.
4. Click **Preview**. The tool routes through every anchor and draws the result on the map. Sections it flags as suspicious (big detours, U-turns) show in **red**. The map auto-pans to the first red section.
5. **Walk through flagged sections** with **◀ ▶**. For each red section, choose:
   * **Accept** — the routing is fine, just looks suspicious. Move on.
   * **Reroute** — try a different routing with more intermediate anchors. After it runs, you'll see the new line; click **Accept** to keep it or **Use original** / **Undo** to back out.
   * **Use original** — keep the source-track line for this section (drawn dashed amber). Useful when the router is wrong and the original line is right.
   * **Delete section** — when your source has a stray waypoint causing a dogleg. Merges the section with the next one, routing through both as if the bad waypoint never existed.
6. **Or use bulk actions** at the bottom of the panel:
   * **Accept all (N)** — accept every remaining flagged section as-is. Use this when you've eyeballed the map and the red lines actually look fine.
   * **Refine all (N)** — try Reroute on every flagged section in one batch.
7. **Tweak Detail** in step 2 if the file feels too dense or too sparse. The slider thins the result via simplification, keeping curves intact. Live preview — no re-routing needed.
8. Click **Save as new file**. A new file appears in your tree with `(re-routed, {profile})` in the name. The original is untouched.

### Undoing Decisions

After deciding on a section (Accept / Use original / Delete / Reroute+Accept), an **Undo this section** button appears whenever you navigate back to it. This restores that one section's pre-decision state without affecting any other decisions you've made. So if you accepted section #1, then decided on #2, and realize #1 was wrong — just ◀ back to #1 and click Undo.

## Preserve Trackpoints Mode (Step-by-Step)

1. **Select a track** in the [File Tree](/app/file-tree).
2. **Tick "Preserve original trackpoints"**. The Density slider disappears (not used in this mode).
3. **Pick a Profile.** Map Matching only supports three profiles internally, so the dropdown collapses to:
   * **Run/hike** (snap to walking-accessible paths)
   * **Bike** (snap to cycling-accessible roads and paths)
   * **Car** (snap to driving roads only)
     Your previous profile is auto-mapped — e.g. ADV Motorcycle → Car, Mountain bike → Bike. Water profile isn't supported in this mode.
4. Click **Preview**. Each trackpoint is snapped to the nearest road within \~25 m. The map shows the snapped line in green.
5. Click **Save as new file**. The new file has `(road-snapped, {profile})` in the name. Time, elevation, heart rate, cadence, power, temperature — all preserved on every point.

<Note>
  There's no per-item review in Preserve mode. Map matching either worked or it didn't, point by point.
</Note>

## Reading the Colors

Open the **Color guide** link at the top of the tool panel for a live legend. Quick reference:

* **Black** — your original source track. Forced to black while the tool is open so it can't be confused with the routed/flagged colors. Restored to its normal color when you close the tool.
* **Green** — the routed or snapped line, the output of the tool.
* **Red** — a section the tool thinks might be wrong. Only the section you're **currently viewing** shows in red — others stay hidden until you ◀ ▶ to them.
* **Amber dashed** — a section where you chose **Use original**: the tool is keeping your source line here on purpose.
* **Yellow halo** — highlight around the section currently being reviewed.

## Tips for Good Results

* **Routing mode, Density slider** — start in the middle and Preview. If the result cuts too many corners, slide right (more anchors). If the result follows your line too literally and you want a cleaner road match, slide left (fewer anchors).
* **Routing mode, Detail slider** — affects file size only. Doesn't change routing. Default "Standard (\~3 m)" is usually right. Use "Maximum" if you need every point.
* **Preserve mode is for recorded data.** Don't use it for planned routes — there's no reason to "snap" a plotted line; just use Routing mode.
* **If your source line is far from the road you expect**, no Preserve-mode setting will fix that. The radius is 25 m. Beyond that, the snap can't move the line. If the line is 100+ m off, your source data is just on a different feature than you think — paste the coords into Google Maps to verify. If you want the line forced onto a specific road regardless of source, use **Routing mode** (it generates fresh geometry).

## Troubleshooting

### The snapped line doesn't follow road curves between two points

You're in Preserve mode, and the source trackpoints in that section are sparse (no points between two coords that are far apart). Snap mode can only move existing points — it doesn't insert new ones along the road's curve, so the line between two points is drawn as a straight chord. For a curve-following line, use **Routing mode** instead.

### The line is zigzagging between two parallel roads

Map Matching is finding two roads within the 25 m search radius (e.g. a road plus a parallel bike path or utility right-of-way) and the matcher alternates between them point-by-point. This is most common with the **Bike** profile near roads that also have a parallel cycle path. Try **Car** profile instead (commits to one road), or use Routing mode.

### A bunch of `NoSegment` warnings in the console

Map Matching couldn't find a road within the search radius for some chunks of your track. Those chunks pass through with the original recorded coords (no snap applied). Look at the final summary log — if `passthrough` is small relative to total points, the file is mostly fine and just a few sections couldn't be matched (e.g. singletrack on an unmapped trail).

### My decisions were reset after re-Previewing

Changing Density (or any param that affects routing) wipes the cache and rebuilds the review list from scratch. There's currently no decision-persistence across re-Previews. Decide on a Density value you like, *then* go through the review.

### Reroute button does nothing

Should be fixed. If it happens again, open DevTools and check for errors during the Reroute attempt — and please [file a bug](https://github.com/anthropics/claude-code/issues).

### The new file isn't appearing

Check the file tree's root — the new file is created at the top level by default. The naming pattern is `{original name} (re-routed, {profile})` for Routing mode, or `(road-snapped, {profile})` for Preserve mode.

## FAQ

**Will the tool modify my original file?** No. Every Reroute run creates a new file. Your source is read-only as far as this tool is concerned.

**Why does the source track look black when I open the tool?** While the Reroute tool is active, the source line is forced to black so you can clearly distinguish it from the green routed line, the red flagged sections, and the amber "use original" overlay. The original color comes back when you close the tool.

**How much do Preserve-mode calls cost me?** Nothing on your end — the API calls are bundled with your Pro subscription.

**Can I see what shifted and by how much?** Yes — open DevTools console. After every Preview in Preserve mode, a `[MAP_MATCH]` line logs total points, how many snapped, how many passed through, and the average + max distance each point moved.

**Why is the tool gated to Pro?** Reroute uses paid third-party APIs and benefits from being supported by paying users.
