Socket
Book a DemoInstallSign in
Socket

gpxparser

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gpxparser

GPX file parser

3.0.5
Source
npmnpm
Version published
Weekly downloads
7.6K
-40.74%
Maintainers
1
Weekly downloads
 
Created
Source

GPXParser

GPXParser.js

GPXParser.js 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 différence

GPX ? What is this ?

Wikipedia say :

GPX, or GPS Exchange Format, is an XML schema designed as a common GPS data format for software applications.

gpx files are based on xml with specific tags and attributes

For more information about gpx format see http://www.topografix.com/gpx_manual.asp

How to do

Install from npm

npm install --save gpxparser

Load JavaScript file

From an HTML document :

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

From a node.js script :

let gpxParser = require('gpxparser');

Create and parse file

var gpx = new gpxParser(); //Create gpxParser 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 gpxParser Objecto to GeoJSON

let geoJSON = gpx.toGeoJSON();

Documentation

PropertyTypeDescription
xmlSourceXMLXML Object parsed from gpx string file
metadataMetadata objectFile metadata
waypointsArray of Waypoint objectArray of waypoints
tracksArray of Track objectArray of waypoints of tracks
routesArray of Route objectArray of waypoints of routes

Metadata object

PropertyTypeDescription
nameStringFile name
descStringDescription
linkLink objectWeb address
authorFloatAuthor object
timeDateTimeTime

Waypoint object

PropertyTypeDescription
nameStringPoint name
cmtStringComment
descStringPoint description
latFloatPoint latitute
lonFloatPoint longitude
eleFloatPoint elevation

Track object

PropertyTypeDescription
nameStringPoint name
cmtStringComment
descStringPoint description
srcStringUsed device
numberStringTrack identifier
linkStringLink to a web address
typeStringTrack type
pointsArrayPoints object array
distanceDistance ObjectDistance informations about the Route
elevationElevation ObjectElevation informations about the Route

Route object

PropertyTypeDescription
nameStringPoint name
cmtStringComment
descStringPoint description
srcStringUsed device
numberStringTrack identifier
linkStringLink to a web address
typeStringRoute type
pointsArrayPoints object array
distanceDistance ObjectDistance informations about the Route
elevationElevation ObjectElevation informations about the Route

Point object

PropertyTypeDescription
latFloatPoint latitute
lonFloatPoint longitude
eleFloatPoint elevation

Distance object

PropertyTypeDescription
totalFloatTotal distance of the Route/Track
cumulFloatCumulative distance at each point of the Route/Track

Elevation object

PropertyTypeDescription
maxFloatMaximum elevation
minFloatMinimum elevation
posFloatPositive elevation difference
negFloatNegative elevation difference
avgFloatAverage elevation

Author object

PropertyTypeDescription
nameStringAuthor name
emailEmail objectEmail address of the author
linkLink objectWeb address

Email object

PropertyTypeDescription
idStringEmail id
domainStringEmail domain
PropertyTypeDescription
hrefStringWeb address
textStringLink text
typeStringLink type

Keywords

gpx

FAQs

Package last updated on 27 May 2020

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.