Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gpx-builder

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gpx-builder

Builder of GPX files

  • 3.7.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.4K
increased by63.23%
Maintainers
1
Weekly downloads
 
Created
Source

GPX builder

codecov codecov codecov Maintainability

This library creates GPX files based on version 1.1. I recommend you to check full documentation on topografix. Library have also option to use Garmin extensions so you can add cadence, heart rate, speed and other data to your points.

How to use

Install:

npm install gpx-builder

Create your first GPX file:

const { buildGPX, GarminBuilder } = require('gpx-builder');

const { Point } = GarminBuilder.MODELS;

const points = [
    new Point(51.02832496166229, 15.515156626701355, {
        ele: 314.715,
        time: new Date('2018-06-10T17:29:35Z'),
        hr: 120,
    }),
    new Point(51.12832496166229, 15.615156626701355, {
        ele: 314.715,
        time: new Date('2018-06-10T17:39:35Z'),
        hr: 121,
    }),
];

const gpxData = new GarminBuilder();

gpxData.setSegmentPoints(points);

console.log(buildGPX(gpxData.toObject()));

You can use Strava format that support power and distance on top of Garmin standard properties.

const { StravaBuilder } = require('gpx-builder');
const { Point } = StravaBuilder.MODELS;

const points = [
    new Point(51.02832496166229, 15.515156626701355, {
        ele: 314.715,
        time: new Date('2018-06-10T17:29:35Z'),
        hr: 120,
        power: 5,
        distance: 1,
    }),
];

How library works

Library contain two types of classes:

  • Creators - They create xml string from defined Object structure
  • Builders - They offer user friendly way to create data for creators

Library contain two Builders:

Keywords

FAQs

Package last updated on 09 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc