
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
@daturon/mapboxgl-layer-manager
Advanced tools
The Layer Manager for Mapbox GL is a versatile and user-friendly tool designed to streamline the management of map layers within the Mapbox GL environment. This tool simplifies the process of modifying layer order and adjusting and fine-tuning each layer'
The Layer Manager for Mapbox GL is a powerful utility that simplifies the management of layers and sources in the Mapbox GL environment. This package allows easy layer reordering, visibility toggling, opacity adjustments, and other modifications, making it an essential tool for developers working with interactive maps.
It supports dynamic management of multiple sources and layers, allowing developers to dynamically change active sources, reorder layers efficiently, and automatically free unused resources to optimize performance.
You can install the package via npm or yarn:
npm install @daturon/mapboxgl-layer-manager
or
yarn add @daturon/mapboxgl-layer-manager
import { LayerManager } from '@daturon/mapboxgl-layer-manager';
const map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v11',
center: [-74.006, 40.7128],
zoom: 10,
});
const manager = new LayerManager(map);
manager.addSource('my-source', {
type: 'geojson',
data: myGeoJSONData,
});
manager.addLayer({
id: 'my-layer',
type: 'circle',
source: 'my-source',
paint: { 'circle-radius': 5, 'circle-color': '#ff0000' },
});
manager.renderOrderedLayers(['my-layer']); // When we have multiple layers, we can use the renderOrderedLayers method to render them in the correct order. Call this method again when you need a new layer set to be rendered.
manager.setLayerOpacity('my-layer', 0.5);
manager.toggleLayerVisibility('my-layer');
manager.reorderLayer('my-layer', 'another-layer');
manager.setFilter('my-layer', 'my-filter', ['==', 'type', 'park']);
manager.removeFilter('my-layer', 'my-filter');
manager.removeLayer('my-layer');
manager.removeSource('my-source');
We welcome contributions! If you want to improve this package:
git clone https://github.com/daturon/mapboxgl-layer-manager.git
yarn install
git checkout -b feature-name
git commit -m "Add new feature"
This project is licensed under the MIT License.
Happy Mapping!
FAQs
The Layer Manager for Mapbox GL is a versatile and user-friendly tool designed to streamline the management of map layers within the Mapbox GL environment. This tool simplifies the process of modifying layer order and adjusting and fine-tuning each layer'
We found that @daturon/mapboxgl-layer-manager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.