maplibre-gl-layer
Version:
A layer control for MapLibre GL JS
51 lines (40 loc) • 916 B
Markdown
A layer control for [MapLibre GL JS](https://maplibre.org/maplibre-gl-js/docs/).

```sh
npm install maplibre-gl-layer
```
```js
import { Map } from "maplibre-gl";
import "maplibre-gl/dist/maplibre-gl.css";
import { LayerControl } from "maplibre-gl-layer";
import 'maplibre-gl-layer/style.css'
const map = new Map({ /* YOUR_MAP_OPTIONS */ });
/**
* Parameters for LayerControl
* {
* layers: Array<{
* name: string;
* style: string | StyleSpecification;
* checked?: boolean;
* }>;
* }
*/
const layerControl = new LayerControl({
layers: [
{
name: 'STYLE 1',
style: YOUR_AWESOME_STYLE
},
{
name: 'STYLE 2',
style: YOUR_AWESOME_STYLE
}
]
})
map.addControl(layerControl)
```
This project is licensed under the terms of the [MIT license](./LICENSE).