1.7.0 • Published 3 months ago

@bdh-gis/mapbox-gl-draw v1.7.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

@bdh-gis/mapbox-gl-draw

解决:官方重复引用,导致数据源和图层的id重复问题;

Installing

npm install @bdh-gis/mapbox-gl-draw

Draw ships with CSS, make sure you include it in your build.

Usage in your application

JavaScript

When using modules

import mapboxgl from '@bdh-gis/mapbox-gl';
import MapboxDraw from "@bdh-gis/mapbox-gl-draw";

CSS

When using modules

import '@bdh-gis/mapbox-gl-draw/dist/mapbox-gl-draw.css'

Example usage

var map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/streets-v11',
  center: [40, -74.50],
  zoom: 9
});

var Draw = new MapboxDraw();

// Map#addControl takes an optional second argument to set the position of the control.
// If no position is specified the control defaults to `top-right`. See the docs
// for more details: https://docs.mapbox.com/mapbox-gl-js/api/#map#addcontrol

map.addControl(Draw, 'top-left');

map.on('load', function() {
  // ALL YOUR APPLICATION CODE
});