A WebGL JavaScript interactive maps library that can render Mapbox Vector Tiles.
Include the source via HTML tags:
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.4/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.12.4/mapbox-gl.css' rel='stylesheet' />For more information, see the API documentation and examples.
Alternatively, you can npm install mapbox-gl and use it as a bundled dependency with browserify.
The following tools are required on any platform to develop mapbox-gl-js.
Mac users are advised to use Homebrew unless they want to build these packages
manually. APT install steps are relevant to Ubuntu Linux users.
- git
- OSX:
brew install git - APT:
sudo apt-get install git
- OSX:
- node.js
- GNU Make
- imagemagick
- OSX:
brew install imagemagick - APT:
sudo apt-get install imagemagick
- OSX:
On Linux, libglew-dev is required in order to run rendering tests:
$ sudo apt-get install libglew-dev
To install dependencies and build the source files:
$ npm installTo serve the debug page:
$ npm start &
$ open "http://localhost:9966/debug/?access_token="`echo $MapboxAccessToken`This assumes you have the MapboxAccessToken environment variable set to a
Mapbox API token from https://www.mapbox.com/account/apps/.
This command uses mattdesl/budo to watch
source files, rebuild the browserify bundle, and trigger LiveReload updates.
There are two test suites associated with Mapbox GL JS
npm testruns quick unit testsnpm run test-suiteruns slower rendering tests from the mapbox-gl-test-suite repository
The FPS benchmarking page compares the performance of your local copy of GL JS against previously released versions. Benchmarking configuration is within bench/fps/site.js.
To serve the FPS benchmark page:
$ npm start &
$ open "http://localhost:9966/bench/fps/?access_token="`echo $MapboxAccessToken`See docs/README.md.
To prepare a release:
- Run
git checkout master && git merge origin/mb-pagesto mergemb-pagesintomaster - Update
CHANGELOG.mdwith all changes since the last release. A list of commits is available on the GitHub Releases page through a link that says "X commits to master since this release" - Update the version number in
package.json,README.md,bench/fps/site.js,_config.yml, and_config.mb-pages.yml - Run
git commit -a -m "vX.Y.Z"to commit changes - Run
git tag vX.Y.Zto tag the release - Run
git push origin && git push origin --tagsto push the new commit and tag to GitHub - Create a GitHub release using the tag you just pushed and the text in
CHANGELOG.md - The CI server will automatically publish tagged builds to the Mapbox CDN. Wait for this build to finish successfully before proceeding.
- Run
git checkout mb-pages && git merge master && git push origin mb-pagesto mergemasterintomb-pagesand publish documentation. Wait for the examples to publish successfully before proceeding (this can take a few minutes). - Run
git checkout master && npm publishto publish the release to npm.