https://github.com/watergis/mapbox-gl-elevation
This module adds elevation control to mapbox-gl.
https://github.com/watergis/mapbox-gl-elevation
elevation mapbox-gl-js plugin terrain-rgb
Last synced: 5 months ago
JSON representation
This module adds elevation control to mapbox-gl.
- Host: GitHub
- URL: https://github.com/watergis/mapbox-gl-elevation
- Owner: watergis
- License: mit
- Created: 2020-12-13T12:52:33.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-22T14:36:13.000Z (almost 2 years ago)
- Last Synced: 2024-10-30T05:43:08.705Z (6 months ago)
- Topics: elevation, mapbox-gl-js, plugin, terrain-rgb
- Language: TypeScript
- Homepage: https://watergis.github.io/mapbox-gl-elevation/
- Size: 5.75 MB
- Stars: 24
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-maplibre - mapbox-gl-elevation - Adds a control to retrieve altitude from terrain RGB tilesets. (User Interface Plugins / JavaScript)
README
# mapbox-gl-elevation




This module adds elevation control to mapbox-gl.
## Installation:
```bash
npm i @watergis/mapbox-gl-elevation --save
```## Demo:
Try [codesandbox](https://codesandbox.io/s/mapbox-gl-elevation-cldfe).
See [demo](https://watergis.github.io/mapbox-gl-elevation).

## Usage:
```ts
import MapboxElevationControl from "@watergis/mapbox-gl-elevation";
import '@watergis/mapbox-gl-elevation/css/styles.css';
import mapboxgl from 'mapbox-gl';const map = new mapboxgl.Map();
map.addControl(new MapboxElevationControl(
'https://wasac.github.io/rw-terrain/tiles/{z}/{x}/{y}.png',
{
font: ['Roboto Medium'],
fontSize: 12,
fontHalo: 1,
mainColor: '#263238',
haloColor: '#fff',
}
), 'top-right');
});
```## Development:
```bash
npm run lint # check styling of source code
npm run lint:fix # fix styling by eslint
npm run dev
```open [http://localhost:8080](http://localhost:8080).
If there are any changes on source code, it will be reflected automatically.
## Build package:
```bash
npm run build
```The modules will be generated under `dist` folder.
## Deploy to Github pages
```bash
npm run deploy
```It will deploy files under `example` folder to gh-pages.
## How to release
```zsh
npm version patch # it increase patch version 0.0.X
npm version minor # it increase minor version 0.x.0
npm version major # it increase major version x.0.0
git push origin main --tag
# release CI will create draft release in Github pages, then publish it if it is ready.
# publish CI will deploy npmjs and Github Packages.
```## Contribution
This Mapbox GL Elevation Control is still under development. so most welcome any feedbacks and pull request to this repository.