Vector tiles standards
This guide on vector tile standards explains how data is stored and encoded in vector tiles.
Just as applications make assumptions about what information exists in a database, so do Mapbox tools make assumptions about how vector tiles store geographic information. Understanding these standards can help you understand how to work with Mapbox vector tiles.
This guide covers file format, examples of geometry encoding and attribute encoding, an explanation of the importance of winding order, and a list of concepts not included in the Mapbox vector tile specification.
For information about file formats and extensions, projections and bounds, and the internal structure of vector tiles, you can read the Mapbox Vector Tile Specification on GitHub.
Format
Vector tiles are encoded as Google Protobufs (PBF), which allow for serializing structured data. For clarity, Mapbox Vector Tiles use the .mvt
file suffix. The specification details are largely structured around the rules implemented in the base .proto
file.
Mapbox Vector Tiles are not related at all to OpenStreetMap PBF files. PBFs are a format, much like XML and can take many forms. Mapbox Vector Tiles and OpenStreetMap PBFs are protobuf files, but conform to completely different specifications and are used in different ways.
Encoding geometry
To encode geographic information into a vector tile a tool must convert geographic coordinates, such as latitude and longitude, into vector tile grid coordinates. Vector tiles hold no concept of geographic information. They encode points, lines, and polygons as x
/y
pairs relative to the top left of the grid in a right-down manner.
This is a step-by-step example showing how a single vector tile encodes geometry in the grid. It follows the commands of the "pen" to encode two rings.