Mapbox.js is no longer in active development. To learn more about our newer mapping tools see Mapbox GL JS.
Build anything with Mapbox.js,
a library for fast & interactive maps.
L.mapbox.map('map', 'mapbox.streets')to load your first map. View simple example
The Mapbox.js documentation is organized by methods.
Each method is shown with potential arguments in a table.
Objects returned by constructors are documented by just their object type.
L.mapbox.featureLayer documents a function that
returns a layer for markers. The methods on that object are then documented as
featureLayer.getGeoJSON, and so on.
Asynchronous calls and the `ready` event
Mapbox.js is asynchronous - when you create a layer like
L.mapbox.tileLayer('mapbox.streets'), the layer doesn't immediately know which tiles to load and its attribution information. Instead, it loads the information in an AJAX call.
For most things you'll write, this isn't a problem, since Mapbox.js does a good
job of handling these on-the-fly updates. If you're writing code that needs
to know when layers and other dynamically-loaded objects are ready, you can
ready event to listen for their ready state. For instance:
Similarly, dynamically-loaded objects produce an `error` event if something goes wrong:
Mapbox.js automatically supports Retina screens like those found with Apple hardware and other high-density displays. When Mapbox.js detects that a user has a high-density screen, it will use high-density tiles and marker icons.