1.0.7 • Published 1 year ago

gpx-parser-ts v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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);
1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago