Skip to main content

TileJSON / Tilestats

TileJSON

A TileJSON file contains JSON-encoded metadata about a vector tileset including which layers and fields (columns) can be found in the tiles.

The information in the TileJSON enables clients (such as web viewers) to understand the structure of data in the tileset up front, instead of piecing it together as tiles are loaded.

While not all vector tilesets have a TileJSON file, when it is present there is normally a single TileJSON file per tileset, and this file is typically found at the root in TMS or XYZ based URL schemas, so that applications can make a speculative attempt to fetch it from a known place.

tilestats

`tilestats`` is an inofficial "extension" to TileJSON. It provides column statistics, notably:

  • the data type of each column
  • min/max values for numeric columns (enabling e.g. global color scale calculations).
  • a sample of values for each column

tilestats provide "global" information about the data in the tileset that can allows for e.g. the creation of correct color maps that do not depend on the view (which requires knowing a priori the min and max values of each field / column).

Note that tilestats are not always available for a given tileset, so applications must be prepared to work in their absence. However, tilestats are output by major tilers such as tippecanoe.

Format Description

loaders.gl returns a typed TileJSON object, with merged tilestats information (if present).

export type TileJSON

Fields

DataTypeTileJSONtilestatsDescription
name?stringName of the tileset.
description?stringShort description of the tileset.
version?stringVersion of the tileset.
tileFormat?stringFormat of the tiles in the tileset..
tilesetType?stringType of tileset.
generator?stringGenerating application. (e.g. tippecanoe adds this).
generatorOptions?stringGenerating application options. (e.g. tippecanoe adds this).
scheme?'xyz' | 'tms'Tile indexing scheme. Typically tms, i.e z/x/y coordinates.
tiles?string[]Sharded URLs (can increased loading speed on HTTP 1 connections)
boundingBox?[[w, s], [e, n]]limits of bounding box using axis units and order of specified CRS.
maxZoom?numberMay be set to the maxZoom of the first layer
minZoom?numberMay be set to the minZoom of the first layer
center?number[]Center point of the data in the tileset
htmlAttribution?stringAttribution (can contain HTML syntax)
htmlLegend?stringLegend (can contain HTML syntax)
layers?TileJSONLayer[]Layer information (combines tilestats (if present) and tilejson info)
metaJson?anyAny unparsed, nested JSON metadata
  • boundingBox typing: [min: [w: number, s: number], max: [e: number, n: number]]
export type TileJSONLayer;
DataTypeTileJSONtilestatsDescription
namestringThe name (id) of this layer (tilejson.vector_layers[].id / tilestats.layers[].layer)
description?stringThe description of this layer (tilejson.layer.description)
featureCount?numberThe number of features in this layer (tilestats.layer.count)
dominantGeometry?stringThe dominant geometry type in this layer (tilestats.layer.geometry)
minZoom?numberAn array of details about the first 100 attributes in this layer
maxZoom?number
fieldsTileJSONField[]
export type TileJSONField;
DataTypeTileJSONtilestatsDescription
namestringThe name of this attribute
description?string
typestring
min?numbermin value (if there are any numbers in the values)
max?numbermax value (if there are any numbers in the values)
uniqueValueCount?numberNumber of unique values across the tileset
values?unknown[]An array of this attribute's first 100 unique values