Introducing a new way to review your PRs.

Read the announcement

maplibre / maplibre-tile-spec

Next generation map vector tiles format

View on GitHub

20 documents · Updated Nov 23, 2026

docs / shared-conformance-assets

Shared conformance assets

Shared conformance assets give each language implementation the same inputs and semantic targets. They make interoperability a check of decoded meaning across encoders and decoders, not only a check of one implementation's output bytes. See Cross-language validation for the wider validation model and Automation and releases for how these checks fit into repository automation.

Asset roles

The assets cover small edge cases, broad tile samples, archive conversion, and low-level codec behavior. Together they define the practical range that an implementation must read, write, or preserve.

Asset familyConformance role
Synthetic MLT tilesExercise geometry, columns, stream choices, 3D mesh values, tessellation, and version-specific layouts with focused cases.
Expected JSON resultsState the logical feature content that a decoder must produce from a synthetic tile.
MVT and MLT tile pairsCheck conversion between common vector-tile input and MLT output on simple and real-world data.
MBTiles samplesCheck archive-level conversion, tile selection, metadata, and round-trip behavior.
Binary codec vectorsCheck shared wire-level codecs without requiring a complete tile.

Synthetic tile corpus

Synthetic tiles

Synthetic tiles are small, named cases that isolate one conformance concern. The corpus covers basic and mixed geometry, IDs, property types, null values, compression choices, dictionaries, nested values, measures, elevation values, 3D meshes, triangle-scoped values, and polygon tessellation. The 0x01 and 0x02 directories represent wire-format generations, while 0x01-rust records Rust-specific encodings that remain semantically compatible with the reference cases. test/…/README.md defines the cross-language purpose and the directory rule; rust/…/main.rs describes how Rust-generated cases are checked against the reference set.

The v2 mesh cases make 3D meaning part of the shared target. They pair vertex coordinates and triangle indexes with height modes and vertex- or triangle-scoped values. Polygon cases also cover holes and triangles-only output, including holes that touch the outer ring. These cases keep differences in tessellation and mesh ordering visible while requiring the same decoded geometry and values.

The current string-compression cases exercise FSST with ordinary values, missing values, repeated dictionary values, shared prefixes, and measure values. They span the Rust-specific v1 set and the v2 set, including variants with and without presence data. This keeps changes in string compression and dictionary layout visible across version and language boundaries while preserving the same logical feature content.

The file name is part of the test signal. Names such as np, fpf, tes, tri, fs, bp, and sp mark meaningful stream or layout variants, so a new fixture should preserve the same name-to-purpose link used by the language test suites.

References: test/…/README.md• L1-16 rust/…/main.rs• L1-25 rust/…/main.rs• L2234-2361 test/…/mesh_mvalues_both.json• L1-122 test/…/poly_hole_touching_tri.json• L1-117

Expected logical results

Each synthetic .mlt tile has a same-named .json file that describes its logical result. A decoder compares its output with this result after allowing the shared numeric edge cases, such as NaN and infinity, and a small floating-point tolerance. This keeps the contract focused on features and values rather than on encoder-specific byte layout.

The same pair also supports round-trip checks. A test can decode the reference tile, encode the decoded content again, and decode it once more. The final logical result must still match even when the second encoding uses different compression or stream choices.

References: test/…/index.ts• L8-37 test/…/index.ts• L48-87 ts/…/synthetic.spec.ts• L19-38 ts/…/mltEncoderSynthetic.spec.ts• L16-24

Cross-language coverage

The language suites consume the same synthetic corpus so that one fixture can expose a difference between implementations. Supported cases must match the expected JSON. New v2 mesh and tessellation fixtures use this same semantic rule, even when their valid outputs can differ in vertex or triangle order.

Known gaps remain active as negative checks: a skipped case must continue to fail or produce a different result until the implementation gains support, which prevents an old exclusion from hiding new support.

The C++ suite adds a second contract for generated cases. When a generator can reproduce a fixture, the bytes must match unless the case has a documented reason for byte variation. In those exceptions, decoded JSON must still match. This separates stable wire output from valid alternate encodings such as heuristic string compression or arbitrary tessellation order.

References: ts/…/synthetic.spec.ts• L12-32 rust/…/synthetic.spec.ts• L14-59 cpp/…/synthetic.test.ts• L15-35 cpp/…/test_synthetic.cpp• L88-127 cpp/…/test_synthetic.cpp• L201-237 test/…/mesh_mvalues_both.json• L1-122 test/…/mix_2_mpoly_mpoly_tri.json• L1-309

Real-world tile fixtures

MVT and MLT tile pairs

Real-world fixtures extend the focused synthetic cases with tiles from simple geometry, OpenMapTiles, Amazon, Bing, and OpenStreetMap-derived data. The MVT files are source tiles, while the matching test/expected MLT files are conversion results for the wire-format versions. They show whether an implementation can preserve useful layers and features when data is larger and less controlled than a synthetic case.

The fixture index keeps these sources separate from the synthetic sets. This lets validation compare a common source tile with its expected MLT form while still exposing the resulting MLT tiles to the inspector and other language tests.

References: inspector/…/fixture-index.ts• L73-94 ts/…/mltDecoder.spec.ts• L12-35 test/…/README.md• L1-5

MBTiles samples

The MBTiles samples test the archive boundary rather than one tile in isolation. They provide small reference archives for reading, rewriting, and producing MLT-backed output, while test/fixtures/omt.max1.mbtiles supplies an OpenMapTiles sample used by conversion checks.

Archive validation checks more than tile bytes. It checks that the converted archive carries the expected tile type and coordinates, that an OpenMapTiles archive can decode back to its input, and that a bounding-box extract keeps only overlapping tiles and retains usable metadata.

The archive flow is:

flowchart LR
    A[MBTiles sample] --> B[Read tiles and metadata]
    B --> C[Re-encode tiles as MLT]
    C --> D[Write MBTiles or PMTiles output]
    D --> E[Check tile coverage, metadata, and decoded content]

References: rust/…/from_mbtiles.rs• L42-62 rust/…/from_mbtiles.rs• L873-909 rust/…/mod.rs• L1488-1525

Low-level conformance vectors

FastPFOR vectors

FastPFOR vectors isolate a shared integer compression format from the rest of the MLT tile model. Each vector has encoded 32-bit words and the expected decoded values in canonical big-endian form. They let implementations agree on the wire data and signed-value interpretation before that codec is used inside a tile.

References: test/…/README.md• L1-21

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep every synthetic .mlt paired with a same-stem .json result.
  • When a fixture name changes, update language skip lists and any fixture index starter or grouping that uses its key.
  • When a new wire or stream variant is added, add it to both the reference corpus and the language-specific generator or semantic check that claims coverage.
  • When a mesh or tessellation fixture changes, keep its decoded coordinates, triangles, height metadata, and scoped values aligned with the intended semantic target.
  • When an expected MLT tile is regenerated from an MVT source, keep the source and versioned output aligned across the test/fixtures and test/expected families.
  • When an archive sample changes, recheck tile coordinates, archive metadata, and bounding-box expectations together.
  • When a byte-level exception is added, record why semantic equality remains the required contract.

Important failure modes

TriggerConsequenceGuard
A synthetic tile has no matching JSON fileShared decoder tests cannot build a logical targetThe shared test loader reads the same-stem JSON for every .mlt.
A mesh or triangles-only fixture loses its z values, triangles, or scoped valuesA decoder can pass basic geometry checks while breaking 3D or tessellation meaningCompare the fixture with its expected JSON and keep the v2 mesh and tessellation cases active.
A skip-list entry names no fixtureThe suite can silently drift from its intended coveragegetTestCases rejects unmatched exclusions.
A previously unsupported case starts workingThe old exclusion can hide a newly supported pathNegative checks fail until the case is removed from the exclusion list.
A byte comparison is used for heuristic compression or tessellationA valid alternate encoding is reported as incompatibleC++ exceptions require decoded JSON equality when bytes may vary.
An archive conversion changes tile coverage or metadataThe output archive can look valid while serving the wrong map areaMBTiles tests check coordinates, format metadata, and decoded round trips.
The fixture index cannot read a tile's facetsInspector filters lose coverage information for that tileThe index keeps the tile and treats missing facets as unknown rather than dropping it.

Key files

FileWhy to read it
test/…/README.mdDefines the purpose and directory model of the shared synthetic corpus.
test/…/index.tsDefines how fixtures, expected JSON, tolerances, exclusions, and unsupported cases are shared.
ts/…/synthetic.spec.tsShows the decoder contract against the common logical results.
ts/…/mltEncoderSynthetic.spec.tsShows semantic encoder round trips without requiring identical bytes.
rust/…/synthetic.spec.tsShows how API-specific gaps are kept explicit while the common corpus remains shared.
rust/…/tag02_meshes.rsShows the semantic expectations for v2 meshes, z values, triangle values, and mesh-safe ordering.
cpp/…/test_synthetic.cppShows generated-fixture coverage and the split between byte equality and semantic equality.
inspector/…/fixture-index.tsShows how synthetic, converted, and real-world MLT tiles become one browsable fixture set.
rust/…/mod.rsShows archive conversion and OpenMapTiles round-trip expectations.
test/…/README.mdDefines the standalone codec vector format and its byte order.