GPX parser for runners.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

GPX parser for runners

This is a simple GPX parser for runners who want to parse their gpx files from Nike+, Garmin connect or similar services. The parser only works with trackpoints for now.

Build Status

See it in action here:

How to use...

The module expects a string of gpx data. It does not have a fetch feature.

import gpx from 'gpx-for-runners';

const gpxContent = `<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1" creator="Garmin Connect"
  xmlns:gpxx="" xmlns:xsi="">
    <link href="">
      <text>Garmin Connect</text>
    <name>Paris 14
      <trkpt lon="2.3212804924696684" lat="48.83561119437218">
      <trkpt lon="2.3212731163948774" lat="48.83561563678086">

const gpx = new gpx( gpxContent );

const distance = gpx.distance();
// 4.87939601482932

const pace = gpx.pace();
// "06:03"

const elevation = gpx.elevation();
//  elevation: [{
//    dist: 0.000731177171930792,
//    elevation: 73,
//    time: "00:01"
// },{
//    dist: 0.005157667126616718
//    elevation: 73
//    time: "00:03"
//  }
//  ...
//  ],
//  min: 63,
//  max: 79.4000015258789,
//  gain: 58.4000244140625,
//  loss: -57.60002136230469

const duration = gpx.duration();
//  start: Mon Aug 03 2015 21:07:54 GMT+0200 (CEST) (instance of Date),
//  end: Mon Aug 03 2015 21:37:27 GMT+0200 (CEST) (instance of Date),
//  totalMS: 1773000,
//  total: "29:33"


You need to have node and npm installed to be able to work on this code. If you intent to add or change code you will need to re-render the esdoc.

Install esdoc

npm install -g esdoc

Run esdoc

esdoc -c esdoc.json


npm install


Opens browser as it needs the DOMParser().

npm run test


npm run dev


npm run build