gpx-parser-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

gpx-parser-ts

Yet another GPX parser... This might be useful to you if you are looking for:

  • a way to parse a GPX document into a typed TS object
  • a way to calculate distance or elevation change on a GPX document
  • a way to convert a GPX document into GeoJson

Installation

Simplest way to install gpx-parser-ts is to use npm, just npm install gpx-parser-ts which will download gpx-parser-ts and all dependencies.

Usage

Basic setup:

  const parser: GpxParser = new GpxParser();
  const gpxJson: GpxJson = await parser.parse(gpxString);
  // Do whatever you like with the gpxJson object

Calculate distance (in kilometers):

  const runDistance: number = parser.calculateTotalDistanceForPoints(gpxJson.trk[0].trkseg.trkpt)  

Calculate elevation changes (in meters):

  const elevationData: Elevation = parser.calculateElevationData(gpxJson.trk[0].trkseg.trkpt)  

Convert to geoJson:

    const geoJson = parser.toGeoJSON(gpxJson);

/gpx-parser-ts/

    Package Sidebar

    Install

    npm i gpx-parser-ts

    Weekly Downloads

    4

    Version

    1.0.7

    License

    MIT

    Unpacked Size

    61.3 kB

    Total Files

    17

    Last publish

    Collaborators

    • jballen92