1.0.0 • Published 6 years ago
@craigmc08/parse-gpx v1.0.0
parse-gpx
A parser for the .gpx
file format.
Disclaimer: The gpx specification wasn't used to make this. It was written from a single gpx file and is for personal use. Use at your own risk.
usage
First, install the package:
npm install @craigmc08/parse-gpx
Then, import it into your code and give it a string:
const parseGpx = require('@craigmc08/parse-gpx');
parseGpx('<gpx xml string>').then(gpx => doSomethingWithThe(gpx));
// Alternatively, use the file parser:
const parseGpxFile = require('@craigmc08/parse-gpx').parseFile;
parseFile('./my-gpx-file.gpx').then(gpx => doSomethingWithThe(gpx));
Here's what the gpx
object looks like:
gpx
bounds
north
- Highest latitudesouth
- Lowest latitudewest
- Lowest longitudeeast
- Highest longitudeheight
- Difference between latitudeswidth
- Difference between longitudes
time
Javascript date representing time it started
name
Name of track
tracks
Array of track segments, each containing a TrackPoint
Track Point
latitude
longitude
elevation
time
- Javascript date
contributing
Just submit a pull request. Please try to include what your changes do and why.
Also, ignore that the test/
dir is in the .gitignore. That's not done yet.
1.0.0
6 years ago