MapboxglLayer for maptalks.js
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
demo fix demo May 18, 2018
dist 0.3.1 Mar 15, 2018
test disable test May 2, 2017
.babelrc initial commit Mar 29, 2017
.editorconfig initial commit Mar 29, 2017
.eslintrc initial commit Mar 29, 2017
.gitignore initial commit Mar 29, 2017
.npmignore initial commit Mar 29, 2017
LICENSE initial commit Mar 29, 2017 update api links Jun 2, 2017
circle.yml initial commit Mar 29, 2017
gulpfile.js disable test May 2, 2017
index.js fix zooming offset, close #3 Mar 15, 2018
karma.config.js initial commit Mar 29, 2017
package.json 0.3.1 Mar 15, 2018


NPM Version

A plugin to add mapbox-gl-js as a layer for maptalks.js.




  • Install with npm: npm install maptalks.mapboxgl.
  • Download from dist directory.
  • Use unpkg CDN:


As a plugin, maptalks.mapboxgl must be loaded after maptalks.js and mapbox-gl.js in browsers.

<script type="text/javascript" src=""></script>
<script src=''></script>
<link href='' rel='stylesheet' />
<script type="text/javascript" src=""></script>
var mapboxglLayer = new maptalks.MapboxglLayer('tile',{
        glOptions : {
            'style' : 'mapbox://styles/mapbox/light-v9'

Supported Browsers

IE 11, Chrome, Firefox, other modern and mobile browsers support WebGL.

API Reference

MapboxglLayer is a subclass of maptalks.Layer and inherits all the methods of its parent.


new maptalks.MapboxglLayer(id, options)


get mapbox-gl-js map instance used by the layer

Returns Map


export the layer's JSON.

var json = mapboxglLayer.toJSON();

Returns Object


We welcome any kind of contributions including issue reportings, pull requests, documentation corrections, feature requests and any other helps.


The only source file is index.js.

It is written in ES6, transpiled by babel and tested with mocha and expect.js.


  • Install dependencies
$ npm install
  • Watch source changes and generate runnable bundle repeatedly
$ gulp watch
  • Tests
$ npm test
  • Watch source changes and run tests repeatedly
$ gulp tdd
  • Package and generate minified bundles to dist directory
$ gulp minify
  • Lint
$ npm run lint