geojson-elevation
v1.1.2
Published
Add elevation data to GeoJSON objects
Downloads
68
Readme
GeoJSON Elevation
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-elevationUse
The module exports a single function, addElevation:
addElevation(geojson, elevationProvider, cb)Where
geojsonis the GeoJSON object to add elevation data toelevationProvideris an object with the methodgetElevation(latLng, cb)- typically, you pass aTileSetinstance from node-hgtcbis 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) andgeojson, 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);
}
});