Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.03 KB

README.md

File metadata and controls

44 lines (32 loc) · 1.03 KB

parse gpx

codecov.io Build Status

Parses gpx into json for data processing, for..................reasons.

usage

Note: Version 2.0 no longer takes a file as an input. It takes an XML string instead

const fs = require('fs');
const parseGpx = require('parse-gpx');

let gpxContent = fs.readFileSync('./path/to/some.gpx');

parseGpx(file).then(track => {
    console.log(track.totalDistance()); //8824.24 (metres)

    /*
     {
       latitude: string
       longitude: string
       timestamp: string
       elevation: number
       cadence: number
       heartrate: number
       distanceFromPoint: (trackPoint) => number (distance in metres)
     }
    */
    console.log(track.trackPoints[0]);
});

dev

npm test
npm run coverage

license

do wutever u want whenever u want