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.
Key points
- Return a sublayer from renderSubLayers and reuse props.id so each tile stays unique.
- Match tileSize to the tile service and raise maxRequests only for internal servers.
- Choose refinementStrategy best-available for stable visuals, never for minimal traffic.
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
- TMS tile services need a manually flipped y, otherwise requests fail or tiles misplace.
- A failed tile leaves a blank patch; onTileError is the only visible signal.
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Atlaslog (2026). TileLayer and MVTLayer. https://www.jingweizhi.com/en/deckgl/tutorials/tile-layers.html (accessed 2026-11-03).