ge
geojson-elevation
npm i geojson-elevation
ge

geojson-elevation

Add juicy elevation data to your fresh GeoJSON

by Per Liedman

1.1.2 (see all)License:ISCTypeScript:Not Found
npm i geojson-elevation
Readme

GeoJSON Elevation

Greenkeeper badge

npm version Build status

Add juicy elevation data to your fresh GeoJSON.

Check out the demo app, if you want to get a feel for it.

Install

npm install --save geojson-elevation

Use

The module exports a single function, addElevation:

addElevation(geojson, elevationProvider, cb)

Where

  • geojson is the GeoJSON object to add elevation data to
  • elevationProvider is an object with the method getElevation(latLng, cb) - typically, you pass a TileSet instance from node-hgt
  • cb is a callback that is called when the elevation data has been added (or an error occurs), the callback should take to args: err (undefined if the operation succeeds) and geojson, which is the GeoJSON instance that was passed to the function

Example:

var addElevation = require('geojson-elevation').addElevation,
    TileSet = require('node-hgt').TileSet;

addElevation(geojson, new TileSet('./data'), function(err, geojson) {
    if (!err) {
        console.log(JSON.stringify(geojson));
    } else {
        console.log(err);
    }
});

Downloads/wk

8

GitHub Stars

35

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

8

OPEN ISSUES

2

OPEN PRs

0
VersionTagPublished
1.1.2
latest
4yrs ago
No alternatives found
No tutorials found
Add a tutorial