npm.io
0.6.0 • Published 7 years ago

geojson-elevation-gain

Licence
GNU GPLv3
Version
0.6.0
Deps
0
Size
42 kB
Vulns
0
Weekly
0

Geojson Elevation Gain

pipeline status version semantic-release

Calculate the elevation gain of a Linestring or a Feature geosjon. Geojson points need to contain elevation like [-3.51732,47.760888,19.8]. A Simple Moving Average is applied on the data before the calculation.

Computing elevation gain is a non trivial thing. The aim of the library is to find an acceptable compromise for most usecases.

Install

npm install --save geojson-elevation-gain

or

yarn add geojson-elevation-gain

Usage

To calculate the elevation gain in meter of geojson:

getElevationGain(geojson, nbOfPoints)
  • geojson is the geojson you want to process, could be a Linestring or a feature with a LineString as geometry.
  • nbOfPoints is the width of the SMA.

Development

yarn install

Roadmap

  • Make it works
  • Make it right
  • Better data handling (Bad/No elevation detection)
  • Multiple algorithms

Tests

Tests are performed across a bunch of reference files coming from la-trace.com. Difference between the result of the algorithm and the reference value should be lower than 10% to be considered as correct.

yarn run build
yarn run test