Socket
Book a DemoInstallSign in
Socket

mapbox-gl-layers

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapbox-gl-layers

Layer toggle for [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/)

npmnpm
Version
1.1.0
Version published
Weekly downloads
4
100%
Maintainers
2
Weekly downloads
 
Created
Source

mapbox-gl-layers

Layer toggle for Mapbox GL JS

Install

npm install mapbox-gl-layers

(Note the peer dependency on mapbox-gl!)

Use

CommonJS

var Layers = require('mapbox-gl-layers')

new Layers({
  layers: {
    'ALL PARKS': ['national_park', 'parks'],
    'National Parks': 'national_park',
    'Other Parks': 'parks'
  }
}).addTo(map) // map is the mapbox gl map instance

Standalone script

Add to <head>:

<script src='dist/mapbox-gl-layers.js'></script>
<link href='dist/mapbox-gl-layers.css' rel='stylesheet' />

And then:

<script>
map.on('style.load', function () {
  new MapboxGLLayers({
    layers: {
      'ALL PARKS': ['national_park', 'parks'],
      'National Parks': 'national_park',
      'Other Parks': 'parks'
    }
  }).addTo(map) // map is the mapbox gl map instance
})
</script>

Keywords

mapbox

FAQs

Package last updated on 14 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts