
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
mapbox-gl-layers
Advanced tools
[](https://circleci.com/gh/developmentseed/mapbox-gl-layers)
Layer toggle for Mapbox GL JS
npm install mapbox-gl-layers
(Note the peer dependency on mapbox-gl
!)
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
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>
Creates a layer toggle control
Parameters
options
Object=
options.type
string= Selection type: multiple
to allow independently toggling each layer/group, single
to only choose one at a time. (optional, default 'multiple'
)options.layers
Object= An object determining which layers to include. Each key is a display name (what's shown in the UI), and each value is the corresponding layer id in the map style (or an array of layer ids).options.position
string= A string indicating position on the map. Options are top-right
, top-left
, bottom-right
, bottom-left
. (optional, default 'top-right'
)options.onChange
function= Optional callback called with {name: dispayName, layerIds: [...], active: true|false }
for the clicked layerExamples
(new Layers({ 'National Parks': 'national_park', 'Other Parks': 'parks' }))
.addTo(map)
This is an OPEN open source project. Contributions are welcome!
Steps:
npm install
.npm start
, open http://localhost:9966/example.html,
and start make changes to index.js
and friends.FAQs
[](https://circleci.com/gh/developmentseed/mapbox-gl-layers)
We found that mapbox-gl-layers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.