Skip to content

alongthepike/mapbox-gl-draw

 
 

Repository files navigation

GL Draw

Adds support for drawing and editing features on Mapbox GL JS maps.

Circle CI

Installing

git clone https://github.com/mapbox/mapbox-gl-draw.git
cd mapbox-gl-draw
npm install

Include mapbox-gl-draw.js after mapbox-gl.js

<script src="mapbox-gl.js"></script>
<script src="mapbox-gl-draw.js"></script>

Also include mapbox-gl-draw.css

<link href="mapbox-gl-draw.css" rel="stylesheet" />

Usage

mapboxgl.accessToken = 'YOUR_ACCESS_TOKEN';

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

var Draw = mapboxgl.Draw();

map.addControl(Draw)

See API.md for complete reference.

Developing

Install dependencies, build the source files and crank up a server via:

npm start & open http://localhost:9966/debug

To run the example apps

npm run-script build-examples
npm start
open http://localhost:9966/examples/geojson-editor/ && open http://localhost:9966/examples/node/

Testing

npm run test

About

Draw tools for mapbox-gl-js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.9%
  • HTML 4.8%
  • Shell 0.3%