This API is available for developer preview and may be changed or removed at any time without notice.

Tileset Statistics

Tileset statistics are metadata about attributes that exist in the data behind a set of vector tiles. Statistics are provided per layer in the tileset, and include:

  • the most common geometry type present in the layer (e.g. Point, LineString, Polygon)
  • the total number of features in the layer
  • a summary of attribute statistics across all the features in the layer
  • data type, min, max and unique values for each attribute in the layer

The tileset statistics API provides a mechanism for retrieving these metadata.

Retrieve tileset statistics

Return high-level information about a tileset. The response is a collection of layer objects describing the layers in the tileset. Each layer object is structured as follows:

{
  "account": {account},
  "tilesetid": {tilesetid},
  "layer": {layername},
  "geometry": Point,
  "count": 10,
  "attributes": [
    {
      attribute: {attribute name},
      min: 0,
      max: 10,
      values: [0, 10]
    }
  ]
}
  • account: the username of the tileset’s owner
  • tilesetid: the identifier for the tileset to which this layer belongs
  • layer: the name of the layer
  • geometry: one of Point, MultiPoint, LineString, MultiLineString, Polygon, or MultiPolygon
  • count: the total number of features
  • attributes: an array of objects representing the attributes that are used in this layer
  • attributes.attribute: the name of the attribute
  • attributes.min: the minimum value of the attribute
  • attributes.max: the maximum value of the attribute
  • attributes.values: up to 100 unique values for the attribute

Example request

GET /tilestats/v1/{account}/{tilesetid}

Example response

HTTP 200 OK

{
  "account": {account},
  "tilesetid": {tilesetid},
  "layers": [
    {
      "account": {account},
      "tilesetid": {tilesetid},
      "layer": {layername},
      "geometry": Point,
      "count": 10,
      "attributes": [
        {
          attribute: {attribute name},
          min: 0,
          max: 10,
          values: [0, 10]
        }
      ]
    },
    {
      "account": {account},
      "tilesetid": {tilesetid},
      "layer": {layername},
      "geometry": LineString,
      "count": 100,
      "attributes": [
        {
          attribute: {attribute name},
          min: 0,
          max: 10,
          values: [0, 10]
        }
      ]
    }
  ]
}

Retrieve attribute statistics

Return statistics about a specific attribute’s values across all the features in a layer. Each response object is structured as follows:

{
  "account": {account},
  "tilesetid": {tilesetid},
  "layer": {layername},
  "attribute": {attributename},
  "type": "string",
  "min": "apple",
  "max": "banana",
  "values": [
    "apple",
    "banana"
  ]
}
  • account: the username of the tileset’s owner
  • tilesetid: the identifier for the tileset to which this attribute belongs
  • layer: the name of the layer to which this attribute belongs
  • attribute: the name of the attribute
  • type: the data type of the attribute, one of string or number
  • min: the minimum value for the attribute
  • max: the maximum value for the attribute
  • values: an array of unique values for the attribute

Example request

GET /tilestats/v1/{account}/{tilesetid}/{layername}/{attributename}

Example response

HTTP 200 OK

{
  "account": {account},
  "tilesetid": {tilesetid},
  "layer": {layername},
  "attribute": {attributename},
  "type": "string",
  "min": "apple",
  "max": "banana",
  "values": [
    "apple",
    "banana"
  ]
}