A C++ implementation of the MapLibre Tile (MLT) vector tile format.
CMake and Bazel build support.
git submodule update --init --recursive
cmake -GNinja -Bbuild -S.
cmake --build build --target mlt-cpp-test mlt-cpp-jsonbuild/test/mlt-cpp-test
To decode a tile:
- Deserialize the tileset metadata
- Create a
Decoder - Call
decodewith the metadata and a view on the raw tile data
To use the standard packing of metadata and data within a tile, use decodeTile.
#include <mlt/decoder.hpp>
#include <mlt/metadata/tileset.hpp>
...
auto metadata = mlt::metadata::tileset::read({metadataBuffer.data(), metadataBuffer.size()});
mlt::Decoder decoder;
const auto tile = decoder.decode({mltBuffer.data(), mltBuffer.size()}, metadata);
const auto tile2 = decoder.decodeTile({tileData.data(), tileData.size()});A simple application which dumps a tile/metadata file pair to JSON format.
build/tool/mlt-cpp-json ../test/expected/tag0x01/bing/4-12-6.mlt- The C++ encoder supports detecting nullable columns in cases where the Java implementation (as of 04/2026) always encodes nullable columns with trivial presence streams. The
EncoderConfig.forceNullableColumnsoption must be set in some cases for parity. - Java uses closed rings in generateMixed because it is building JTS Polygon objects, and JTS polygon rings are expected to be closed. But when Java converts geometry to MLT streams, it deliberately strips the duplicated closing vertex, to be synthesized on decoding. The C++ encoder does not use JTS and encodes the geometry exactly as provided, so closing vertices should not be provided.