Package Exports
- mapbox-gl-draw-additional-tools
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mapbox-gl-draw-additional-tools) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mapbox-gl-draw-additional-tools
Some additional tools for MapboxGL-Draw like Union, Copy, Buffer and ...
DEMO
Install
npm install mapbox-gl-draw-additional-tools
or use CDN:
<script src="https://unpkg.com/mapbox-gl-draw-additional-tools"></script>
Usage
import mapboxGl from 'mapbox-gl';
import MapboxDraw from '@mapbox/mapbox-gl-draw';
import additionalTools from 'mapbox-gl-draw-additional-tools';
const map = new mapboxgl.Map({
container: 'map', // container id
style: 'mapbox://styles/mapbox/streets-v11',
center: [-91.874, 42.76], // starting position
zoom: 12, // starting zoom
});
const draw = new MapboxDraw({
modes: {
...MapboxDraw.modes,
},
userProperties: true,
union: true, // Default is true. If set to false, the button does not appear in toolbox
copy: true, // Default is true. If set to false, the button does not appear in toolbox
buffer: true, // Default is true. If set to false, the button does not appear in toolbox
bufferSize: 0.5, // Default is 500
bufferUnit: 'kilometers', //Default is kilometers. It can be miles, degrees or kilometers
bufferSteps: 64, // Default is 64
});
map.addControl(draw);
map.addControl(additionalTools(draw), 'top-right');
Example
License
MIT © ReyhaneMasumi