JSPM

mapbox-gl-draw-additional-tools

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 26
  • Score
    100M100P100Q55786F
  • License MIT

Some additional tools for MapboxGL Draw like Union, Copy, Buffer and ...

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

NPM Develop Release

mapbox-gl-draw-additional-tools

Some additional tools for MapboxGL-Draw like Union, Copy, Buffer and ...

DEMO

A Gif showing demo usage

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