Atlaslog
Atlaslog / deck.gl / Tutorial / TileLayer and MVTLayer
deck.gl · Tutorial

TileLayer and MVTLayer

Quick answer

This tutorial explains that TileLayer only schedules tiles and delegates drawing to renderSubLayers, where props.tile and props.data feed a real layer. It builds a tiled GeoJsonLayer, compares it with MVTLayer and its binary option, and tunes maxRequests, refinementStrategy, maxCacheSize and onTileError. Readers can serve hundreds of thousands of features without loading one giant file.

Last verified 2026-11-03 · deck.gl 9.0 · Cite this page
Key points
Example
var parcelsTile = new deck.TileLayer({
  id: 'parcels-tiles',
  data: 'https://tiles.example.com/parcels/{z}/{x}/{y}.geojson',
  minZoom: 8,
  maxZoom: 16,
  tileSize: 256,
  maxRequests: 8,
  refinementStrategy: 'best-available',
  renderSubLayers: function (props) {
    var west = props.tile.bbox.west;
    var south = props.tile.bbox.south;
    var east = props.tile.bbox.east;
    var north = props.tile.bbox.north;

    return new deck.GeoJsonLayer({
      id: props.id,
      data: props.data,
      filled: true,
      stroked: true,
      getFillColor: [31, 95, 208, 90],
      getLineColor: [255, 255, 255, 200],
      getLineWidth: 1,
      lineWidthUnits: 'pixels',
      pickable: true
    });
  }
});
var mvt = new deck.MVTLayer({
  id: 'base-mvt',
  data: 'https://tiles.example.com/base/{z}/{x}/{y}.pbf',
  minZoom: 0,
  maxZoom: 14,
  binary: true,
  getFillColor: function (f) {
    var kind = f.properties.kind;
    if (kind === 'water') return [20, 80, 160, 200];
    if (kind === 'park') return [60, 160, 90, 180];
    return [230, 230, 230, 120];
  },
  getLineColor: [255, 255, 255, 180],
  getLineWidth: 1,
  lineWidthMinPixels: 1,
  pickable: true
});
Notes
Runnable examplesChinese originalAll Tutorials
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). TileLayer and MVTLayer. https://www.jingweizhi.com/en/deckgl/tutorials/tile-layers.html (accessed 2026-11-03).