gpx-export

Lightweight, portable GPX 1.1 generation without dependencies.

gpx-export generates GPX 1.1 XML from JavaScript and TypeScript objects. It supports full-document output with metadata, waypoints, routes, and tracks, and runs in Node.js, web, and mobile runtimes.

import { generateGpx } from "gpx-export";

const now = new Date();

const gpx = generateGpx(
  {
    name: "Morning Ride",
    points: [
      {
        lat: 54.5741,
        lon: -1.3180,
        time: now,
        elevation: 32.4,
        speed: 5.2
      }
    ]
  },
  {
    name: "Morning Ride",
    time: now
  }
);

console.log(gpx);

The output always uses GPX 1.1 root/schema declarations. Garmin TrackPointExtension v2 declarations are added automatically when Garmin metrics are present on track points.