@vizzuality/layer-manager-react
npm i @vizzuality/layer-manager-react

@vizzuality/layer-manager-react

A library to get a layer depending on provider and layer spec

by Vizzuality

1.2.0 (see all)License:MITTypeScript:Built-In
npm i @vizzuality/layer-manager-react
Readme

Run tests

Layer Manager

This library will help you to manage the addition and removal of layers. It also provides methods to set opacity, visibility and zIndex.

We currently only supports Mapbox spec. Leaflet or Google Maps Plugin are not supported yet.

Docs

Quick start with MapboxGL

import mapboxgl from 'mapbox-gl';
import MapboxGLPlugin from '@vizzuality/layer-manager-plugin-mapboxgl';
import CartoProvider from '@vizzuality/layer-manager-provider-carto';
import LayerManager from '@vizzuality/layer-manager';

mapboxgl.accessToken = '<your access token here>';

const map = new mapboxgl.Map({
    container: 'map', // container ID
    style: 'mapbox://styles/mapbox/streets-v11', // style URL
    center: [-74.5, 40], // starting position [lng, lat]
    zoom: 9 // starting zoom
});

const plugin = new MapboxGLPlugin(map, pluginOptions); // required
const layerManager = new LayerManager(plugin);

// Optionally you can add additional providers
const provider = new CartoProvider();
LayerManager.registerProvider(provider); // optional

layerManager.add(layerSpec); // see docs/LAYER-SPEC.md
layerManager.remove(1);

Downloads/wk

177

GitHub Stars

16

LAST COMMIT

1mo ago

MAINTAINERS

7

CONTRIBUTORS

17

OPEN ISSUES

8

OPEN PRs

1
VersionTagPublished
1.2.0
latest
1mo ago
No alternatives found
No tutorials found
Add a tutorial