style-optimized vector tiles

Style-optimized vector tiles, available through the Mapbox Vector Tiles API, remove any layers or features in the tile that are not represented by a Mapbox style. Style-optimized vector tiles are smaller, served over-the-wire, and a way to reduce the size of offline caches.

For example, say you have a style that references a tileset with four layers: campsites, mountains, forestland, and buildings. The final map includes icons for campsites, a pattern for forests, and a pattern for blue mountains, but does not use buildings. In a normal Mapbox GL map, the tiles loaded include all four layers even though they aren’t all needed. A style-optimized vector tile includes only campsites, forestland, and blue mountains. It removes unused layers and features based on attributes and zoom levels.

illustration comparing normal vector tilesets on the left and style-optimized vector tilesets on the right

You can use style-optimized vector tilesets in Mapbox GL JS by adding ?optimize=true to the end of your style URL:

var map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/outdoors-v9?optimize=true' // optimize=true
Was this page helpful?