geojson-elevation-gain

compute the elevation gain of a geojson

Usage no npm install needed!

<script type="module">
  import geojsonElevationGain from 'https://cdn.skypack.dev/geojson-elevation-gain';
</script>

README

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