diff --git a/docs/gpx-extensions.md b/docs/gpx-extensions.md new file mode 100644 index 0000000..3b231e1 --- /dev/null +++ b/docs/gpx-extensions.md @@ -0,0 +1,101 @@ +# trails.cool GPX Extensions + +trails.cool uses a custom XML namespace to store planning metadata in GPX files. This allows round-tripping through export, import, and Journal save without losing information. + +## Namespace + +``` +xmlns:trails="https://trails.cool/gpx/1" +``` + +Declared on the root `` element whenever any extension is present. + +--- + +## `` — POI metadata on waypoints + +Stored inside ``. Carries the OpenStreetMap node ID and key tags for waypoints that were snapped to a POI in the Planner. + +### Syntax + +```xml + + Bike Shop Berlin + + + + + + + + + + + + +``` + +### Attributes + +| Attribute | Required | Description | +|-----------|----------|-------------| +| `osmId` | no | OSM node ID (integer). Present when the waypoint was snapped to a known OSM node. | + +### Child elements + +Each `` stores one OSM tag. The following keys are persisted: + +| Key | Description | +|-----|-------------| +| `phone` / `contact:phone` | Phone number | +| `website` | Website URL | +| `opening_hours` | OSM opening hours string (e.g. `Mo-Fr 09:00-18:00`) | +| `addr:street` | Street name | +| `addr:housenumber` | House number | +| `addr:postcode` | Postal code | +| `addr:city` | City | +| `amenity` | OSM amenity value (e.g. `bicycle_shop`) | +| `tourism` | OSM tourism value (e.g. `camp_site`) | +| `shop` | OSM shop value | + +### Display + +The Journal route detail page renders a **Waypoints** section when at least one waypoint has POI metadata. Phone numbers become `tel:` links; websites become `https:` links. + +--- + +## `` — Planning metadata on routes + +Stored inside the top-level `` element. Carries no-go areas defined in the Planner. + +### Syntax + +```xml + + + + + + + + + +``` + +### Elements + +| Element | Description | +|---------|-------------| +| `` | Container for all planning metadata. | +| `` | A no-go area polygon. Requires at least 3 `` children. Multiple `` elements are allowed. | +| `` | A vertex of the no-go polygon. | + +No-go areas are passed to BRouter when computing routes, which routes around them. They are preserved through export/import and Journal save. + +--- + +## Compatibility + +These extensions are **forward-compatible**: parsers that don't know the `trails:` namespace will ignore the `` blocks and load the file as a normal GPX. Geometry, waypoint names, and elevation data are always stored in standard GPX elements. + +The namespace URI `https://trails.cool/gpx/1` is versioned. If the schema changes incompatibly, the minor version will increment.