Skip to content

mapbox/mapbox.js

publisher-prod…
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
October 24, 2016 19:19
August 8, 2023 15:41
October 12, 2023 11:22
February 22, 2019 16:10
February 25, 2019 19:58
February 12, 2019 09:48
April 29, 2020 15:28
September 15, 2023 16:29
March 20, 2020 15:58
December 9, 2013 20:38
December 9, 2013 20:38
January 17, 2019 17:08
December 9, 2013 20:38
February 25, 2019 19:58
November 9, 2020 16:20
November 28, 2016 13:18
April 15, 2017 13:03
April 29, 2020 15:31
April 29, 2020 15:31

mapbox.js

Build Status

A Mapbox plugin for Leaflet, a lightweight JavaScript library for traditional raster maps.

For the state-of-the-art Mapbox vector maps library, see Mapbox GL JS.

API

Managed as Markdown in API.md, following the standards in DOCUMENTING.md

Examples

Usage

Recommended usage is via the Mapbox CDN, with code snippets available on the official documentation page

The mapbox.js file includes the Leaflet library. Alternatively, you can use mapbox.standalone.js, which does not include Leaflet (you will have to provide it yourself).

See the API documentation and Examples for further help.

Usage with Browserify

Install the mapbox.js module and add it to dependencies in package.json:

npm install mapbox.js --save

Require mapbox in your script:

// main.js

require('mapbox.js'); // <-- auto-attaches to window.L

Browserify it:

browserify main.js -o bundle.js

Usage as Download

You can download a built release at the mapbox.js-bower repository.

Building

Requires node.js installed on your system.

git clone https://github.com/mapbox/mapbox.js.git
cd mapbox.js
npm install
make

This project uses browserify to combine dependencies and installs a local copy when you run npm install. make will build the project in dist/.

Tests

Test with phantomjs:

npm test

To test in a browser, run a local development server and go to /test.

Version v0.x.x

Version v0.x.x can be accessed in the v0 branch..

Editing Icons

Requirements:

inkscape
pngquant
  1. Make edits to theme/images/icons.svg.
  2. Run ./theme/images/render.sh to update sprites from your edits.
  3. Add a CSS reference with the appropriate pixel coordinate if adding a new icon.

Running documentation locally

Documentation is powered by Jekyll. Running using the following command:

./jekyll.sh