Legacy

Mapbox.js is no longer in active development. To learn more about our newer mapping tools see Mapbox GL JS.

You are viewing an older version of Mapbox.js. Check out v3.3.1 for the latest.

L.mapbox.styleLayer(url, options)

Extends: L.tileLayer

L.mapbox.styleLayer provides a way to integrate styles created with Mapbox Studio into your map.

Options Value Description
url string Must be a string like mapbox://styles/mapbox/cin286r4x006safncofpcb71v
options object If provided, it is the same options as provided to L.tileLayer, as well as:
  • sanitizer: A function that accepts a string containing tooltip data, and returns a sanitized result for HTML display. The default will remove dangerous script content, and is recommended.

Example:

var styleLayer = L.mapbox.styleLayer(url)
    .addTo(map);

Returns a L.mapbox.styleLayer object.