Class: gpxParser

gpxParser


new gpxParser()

GPX file parser

Methods


calcDistanceBetween(wpt1, wpt2)

Calcul Distance between two points with lat and lon
Parameters:
Name Type Description
wpt1 A geographic point with lat and lon properties
wpt2 A geographic point with lat and lon properties
Returns:
The distance between the two points
Type
float

calcElevation(points)

Generate Elevation Object from an array of points
Parameters:
Name Type Description
points An array of points with ele property
Returns:
An object with negative and positive height difference and average, max and min altitude data
Type
ElevationObject

calculDistance(points)

Calcul the Distance Object from an array of points
Parameters:
Name Type Description
points An array of points with lat and lon properties
Returns:
An object with total distance and Cumulative distances
Type
DistanceObject

calculSlope(points, cumul)

Generate slopes Object from an array of Points and an array of Cumulative distance
Parameters:
Name Type Description
points An array of points with ele property
cumul An array of cumulative distance
Returns:
An array of slopes
Type
SlopeObject

getElementValue(parent, needle)

Get value from a XML DOM element
Parameters:
Name Type Description
parent Element Parent DOM Element
needle string Name of the searched element
Returns:
The element value

parse(gpxstring)

Parse a gpx formatted string to a GPXParser Object
Parameters:
Name Type Description
gpxstring string A GPX formatted String
Returns:
A GPXParser object
Type
gpxParser

queryDirectSelector(parent, needle)

Search the value of a direct child XML DOM element
Parameters:
Name Type Description
parent Element Parent DOM Element
needle string Name of the searched element
Returns:
The element value

toGeoJSON()

Export the GPX object to a GeoJSON formatted Object
Returns:
a GeoJSON formatted Object