npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gpx-js

v1.1.0

Published

GPX file parser

Downloads

6

Readme

GpxJs

GpxJs is a lightweight JS library wich parse .gpx file and get or compute various datas like

  • GPX metadata
  • total and cumulate distances
  • min, max, average, positive and negative height difference
  • Hr, Cadence, Temperature (exported from Garmin devices)

It is created by Lucas, Original Repo

I added some support to new elements exported from my Garmin Edge 830 device as HR, Cadence and Temperature

How to do

Install from npm

npm install --save gpx-js

Load JavaScript file

From an HTML document :

<script src="./js/GpxJs.js"></script>

From a node.js script :

let gpx = require('gpx-js');

Create and parse file

var gpx = new GpxJs(); //Create GpxJs Object
gpx.parse("<xml><gpx></gpx></xml>"); //parse gpx file from string data

Use the gpx Object

var totalDistance = gpx.tracks[0].distance.total;

Export GpxJs Object to GeoJSON

let geoJSON = gpx.toGeoJSON();

Documentation

| Property | Type | Description| | ------------- | ------------- | ------------- | | xmlSource | XML | XML Object parsed from gpx string file | | metadata | Metadata object | File metadata | | waypoints | Array of Waypoint object | Array of waypoints | | tracks | Array of Track object | Array of waypoints of tracks | | routes | Array of Route object | Array of waypoints of routes |

Metadata object

| Property | Type | Description | | -------- | ------ | ----------------- | | name | String | File name | | desc | String | Description | | link | Link object | Web address | | author | Float | Author object | | time | DateTime | Time |

Waypoint object

| Property | Type | Description | | -------- | ------ | ----------------- | | name | String | Point name | | cmt | String | Comment | | desc | String | Point description | | lat | Float | Point latitute | | lon | Float | Point longitude | | ele | Float | Point elevation | | time | Date | Point time |

Track object

| Property | Type | Description | | -------- | ------ | ----------------- | | name | String | Point name | | cmt | String | Comment | | desc | String | Point description | | src | String | Used device | | number | String | Track identifier | | link | String | Link to a web address | | type | String | Track type | | points | Array | Points object array | | distance | Distance Object | Distance informations about the Route | | elevation | Elevation Object | Elevation informations about the Route | | slopes | Float Array | Slope of each sub-segment|

Route object

| Property | Type | Description | | -------- | ------ | ----------------- | | name | String | Point name | | cmt | String | Comment | | desc | String | Point description | | src | String | Used device | | number | String | Track identifier | | link | String | Link to a web address | | type | String | Route type | | points | Array | Points object array | | distance | Distance Object | Distance informations about the Route | | elevation | Elevation Object | Elevation informations about the Route | | slopes | Float Array | Slope of each sub-segment|

Point object

| Property | Type | Description | | -------- | ------ | ----------------- | | lat | Float | Point latitute | | lon | Float | Point longitude | | ele | Float | Point elevation | | time | Date | Point time | | hr | Int | Point Hear rate | | cad | Int | Point Cadence | | atemp | Int | Point Temperature |

Distance object

| Property | Type | Description | | -------- | ------ | ----------------- | | total | Float | Total distance of the Route/Track | | cumul | Float | Cumulative distance at each point of the Route/Track |

Elevation object

| Property | Type | Description | | -------- | ------ | ----------------- | | max | Float | Maximum elevation | | min | Float | Minimum elevation | | pos | Float | Positive elevation difference | | neg | Float | Negative elevation difference | | avg | Float | Average elevation |

Author object

| Property | Type | Description | | -------- | ------ | ----------------- | | name | String | Author name | | email | Email object | Email address of the author | | link | Link object | Web address |

Email object

| Property | Type | Description | | -------- | ------ | ----------------- | | id | String | Email id | | domain | String | Email domain |

Link object

| Property | Type | Description | | -------- | ------ | ----------------- | | href | String | Web address | | text | String | Link text | | type | String | Link type |