Coder Social home page Coder Social logo

maptalks.mapboxgl's Introduction

maptalks.mapboxgl

NPM Version

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

screenshot

Examples

Install

  • Install with npm: npm install maptalks.mapboxgl.
  • Download from dist directory.
  • Use unpkg CDN: https://unpkg.com/maptalks.mapboxgl/dist/maptalks.mapboxgl.min.js

Usage

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

<script type="text/javascript" src="https://unpkg.com/maptalks/dist/maptalks.min.js"></script>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.36.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.36.0/mapbox-gl.css' rel='stylesheet' />
<script type="text/javascript" src="https://unpkg.com/maptalks.mapboxgl/dist/maptalks.mapboxgl.min.js"></script>
<script>
var mapboxglLayer = new maptalks.MapboxglLayer('tile',{
        glOptions : {
            'style' : 'mapbox://styles/mapbox/light-v9'
        }
    }).addTo(map);
</script>

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.

Constructor

new maptalks.MapboxglLayer(id, options)

getGlMap()

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

Returns Map

toJSON()

export the layer's JSON.

var json = mapboxglLayer.toJSON();

Returns Object

Contributing

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

Develop

The only source file is index.js.

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

Scripts

  • 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

maptalks.mapboxgl's People

Contributors

fuzhenn avatar 1dent1ty avatar jakob-fuchs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.