Coder Social home page Coder Social logo

jiuyuong / mapbox-gl-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mapbox/mapbox-gl-js

0.0 3.0 0.0 27.56 MB

Interactive vector maps in the browser, powered by WebGL

Home Page: https://www.mapbox.com/mapbox-gl-js/

License: Other

JavaScript 95.34% HTML 3.59% Shell 0.19% CSS 0.88%

mapbox-gl-js's Introduction

Build Status Coverage Status

Mapbox GL JS

Mapbox GL JS is a Javascript & WebGL library that renders interactive maps from vector tiles and Mapbox styles.

It is part of the Mapbox GL ecosystem which includes Mapbox GL Native, a suite of compatible SDKs for native desktop and mobile applications.

Mapbox GL JS gallery

Using Mapbox GL JS with a <script> tag

To use the vector tiles and styles hosted on http://mapbox.com, you must create an account and then obtain an access token. You may learn more about access tokens here.

<!DOCTYPE html>
<html>
<head>
    <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.js'></script>
    <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.css' rel='stylesheet' />
</head>

<body>
    <div id='map' style='width: 400px; height: 300px;' />

    <script>
        mapboxgl.accessToken = '<your access token here>';
        var map = new mapboxgl.Map({
            container: 'map',
            style: 'mapbox://styles/mapbox/streets-v9'
        });
    </script>
</body>
</html>

Using Mapbox GL JS with Browserify

To use the vector tiles and styles hosted on http://mapbox.com, you must create an account and then obtain an access token. You may learn more about access tokens here.

Install the mapbox-gl npm package

npm install --save mapbox-gl

Instantiate mapboxgl.Map

var mapboxgl = require('mapbox-gl');
mapboxgl.accessToken = '<your access token here>';
var map = new mapboxgl.Map({
    container: '<your HTML element id>',
    style: 'mapbox://styles/mapbox/streets-v9'
});

Using Mapbox GL JS with Webpack

To use the vector tiles and styles hosted on http://mapbox.com, you must create an account and then obtain an access token. You may learn more about access tokens here.

Install the mapbox-gl npm package and the required loaders.

npm install --save mapbox-gl
npm install --save transform-loader
npm install --save json-loader
npm install --save webworkify-webpack

Add the required additional options from webpack.config.example.js to your webpack configuration.

Instantiate mapboxgl.Map

var mapboxgl = require('mapbox-gl');
mapboxgl.accessToken = '<your access token here>';
var map = new mapboxgl.Map({
    container: '<your HTML element id>',
    style: 'mapbox://styles/mapbox/streets-v9'
});

Using import

If you're using the ES6 module system, you can import mapboxgl like so:

import mapboxgl from 'mapbox-gl';

Contributing to Mapbox GL JS

See CONTRIBUTING.md.

mapbox-gl-js's People

Contributors

ansis avatar mourner avatar jfirebaugh avatar kkaefer avatar tmcw avatar yhahn avatar tristen avatar bhousel avatar dmitrig01 avatar mikemorris avatar tatsvc avatar scothis avatar edenh avatar katydecorah avatar incanus avatar 1ec5 avatar kapadia avatar kelvinabrokwa avatar samanpwbb avatar mcwhittemore avatar lyzidiamond avatar vicapow avatar danswick avatar brunoabinader avatar anandthakker avatar willwhite avatar michaelsteffen avatar indus avatar blanchg avatar jingsam avatar

Watchers

James Cloos avatar  avatar  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.