Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/perliedman/geojson-elevation
Add juicy elevation data to your fresh GeoJSON
https://github.com/perliedman/geojson-elevation
Last synced: 4 months ago
JSON representation
Add juicy elevation data to your fresh GeoJSON
- Host: GitHub
- URL: https://github.com/perliedman/geojson-elevation
- Owner: perliedman
- License: isc
- Created: 2015-04-08T19:30:13.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-05-25T04:09:13.000Z (over 4 years ago)
- Last Synced: 2024-10-31T23:51:26.854Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 734 KB
- Stars: 37
- Watchers: 6
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
GeoJSON Elevation
=================[](https://greenkeeper.io/)
[](https://www.npmjs.com/package/geojson-elevation) [](https://travis-ci.org/perliedman/geojson-elevation)
Add juicy elevation data to your fresh [GeoJSON](http://geojson.org/).
Check out the [demo app](http://www.liedman.net/elevation-service/), if you want to get a feel for it.
## Install
```
npm install --save geojson-elevation
```## Use
The module exports a single function, `addElevation`:
```js
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](https://github.com/perliedman/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 functionExample:
```js
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);
}
});
```