Repository navigation
Replies: 10 comments 12 replies
Is chosen for 0.17% on OMT and 0.09% on Protomaps..
We already have DeltaRLE that has similar characterisitics. |
seem to be all very ineffective, being below the 0.3% bar I would set for all of the bytes to choose this.
From benchmarks, adding an generic FOR yields -0.4..0.5% on OMT or Protomaps being in the 0.1% range on all compressions. |
Need to look into this. Gzipping at the end makes this go down a bit, but not as much as the -40% raw size of edebreaker. |
Still TODO on fastlanes. I know I tried a bit around with storing the duplicated name columns as differences from an earlier name column, but that was very slow to decode and turned out to be only really effective on OMT, so I dropped it. |
We should add that, results seem promising ^^ |
I ran two expeirments:
the delta of static web vs v2 is
the delta of "zstd as total byte count" web vs v2 is
The first is 0.75 enc time, the latter about 4x. |
This one would be nice wouldnt it? Going with an kind of hacked together interning scheme and training on one half of the data + measuring on the second (feels like cheating a bit) on again OMT/Protomaps:
|
A bit drifted topic, but I'd like to benchmark if the tessellated triangles is really worth. I'm not sure about the compressed size, but I naively guess the size is increased compared to the original polygon. On the other hand, the CPU cost of the client-side tessellation (proobably earcut) might not be so expensive. I’ve been wondering whether the reduced CPU load really outweighs the increased network load. While this should be true for complex 3D shapes in general, I'm not sure how it goes with the type of polygons that MLT v2 aims for. (That said, I don't think we can benchmark this easily at the moment. We lack both a tile generator for tessellated polygons and the renderer) |
To anchor this post, As an anchoring, lets split out all the streams from the metadata and compress them. With this in mind, we could decide per stream, keep only streams that shrink, and pack them into one deflate block per layer with a boundary at each stream. This leads us to this napkin math
Using deflate on all streams, this can save us -6.5% on OMT and -4.4% on Protomaps. What is interesting is where they are chosen and where not:
Will look into cost-model aware (on text only for now, I expect Benedikt to have a better format for vertecies and edgebreaker seems to be better at triangles) encodings next (decoding time < time lost decoding) due to the cost model things discovered. |
|
To quickly test some of the strategies from my proposal at the top of this discussion, I ran several agent sessions on different datasets (OpenMapTiles, Protomaps, AWS, Bing Maps, Swisstopo, Overture, ...). Based on the results I currently propose this encoding strategy: keep v1's encodings and add a new one only if it makes tiles smaller after gzip/brotli/zstd. Encodings that only shrink uncompressed tiles become optional extensions (for uses where the uncompressed tile size matters). This maps onto the two profiles proposed above: the Web profile writes only the kept and added encodings and ranks candidates by deflated size; the Standalone profile may also use the standalone-only ones and ranks by stored size.
ResultsAll results are strictly lossless: feature, part and vertex order stay exactly as in the MVT. Relaxed ordering is not included. Geometry is the main target left: vertices are most of a basemap tile's bytes, and they are where the proposal saves the least. Relaxed ordering and junction references will help, but reaching ~30% on geometry-heavy tiles while keeping decoding fast needs more research on geometry encodings. Proposed MLT v2 vs MVT per dataset
Datasets (3,287 tiles; fetched 2026-11-17)The basemaps include all z0–3 tiles. Basemap and Overture tiles are sampled from cities, rural regions and random locations around 34 places worldwide.
Predicted vertices
Predicted: this proposal vs the #2060 stack
Potentially worth taking from #2060: the line-continuation predictor, which may help road-like line layers at little decode cost, and --vertex-sort / --sort chain as opt-in encoder settings. The full geometry encoding is described in MLT_V2_GEOMETRY_COMPRESSION.pdf. Further improvements would be relaxed ordering and junction encodings. |

Uh oh!
There was an error while loading. Please reload this page.
I know I’m joining this discussion late, but as discussed in the MLT meeting, I think the encoding strategy could benefit from another pass. Below is a short compression-first proposal intended to provide a constructive challenge and strengthen the overall design.
MLT v2: Compression Strategy
Status: Early Draft
Summary
bottleneck than general-purpose decompression, especially on mobile networks. MLT v2 should therefore optimize tile
size after gzip, brotli or zstd.
general-purpose backend), not analytics formats such as BtrBlocks, FastLanes or Vortex, which are designed for a
different performance regime.
as the only general-purpose compression stage (terminal/leaf encoding); and omit encodings that provide no gain, or a negative gain, after compression (FastPFOR, bit-packing, FSST, rANS, most forms of RLE, ...).
Motivation
Edge 123, Firefox 126 and Safari 26.3 (caniuse). Clients that decompress tiles
themselves, such as PMTiles readers, use
DecompressionStream, which supports only gzip and deflate in every browser(MDN).
Goals and non-goals
Goals
compression. This
of spending the budget on encodings that only serve 2D rendering on a CPU.
Non-goals
Encoding strategy
Profiles
Web profile
Terminal codec. Always use general purpose compression as leaf/terminal codec. Every tile ends in gzip, brotli or zstd, applied once to the whole tile, with no per-stream entropy or LZ stage compared to OpenZL. The encoder chooses encodings by trial against the deployed compressor.
Lightweight opaque transforms. Like OpenZL's transforms, they need not shrink the data on their own; they make it more compressible for the backend.
Lightweight transparent encodings. Constant and sequence encodings provide O(1) access without materializing a
decoded buffer, reducing decode overhead and improving cache locality, for example during filtering. In v1, they
were special cases of RLE exposed as
ConstantVectorandSequenceVectorin the in-memory format.Spatial predictors for geometry (work in progress by Benedikt Vogl). Use previously decoded neighbouring vertices as
context to predict each vertex, and store only the residual. Inspired by PNG filters (5 predictors), WebP
(14 predictors) and Draco, use a small set of cheap predictors selected by trial compression per layer or, where
worthwhile, at finer feature granularity. Learned predictors such as LSTMs are a longer-term alternative to hand-designed predictors; our initial trials reduce on that topics size but decode too slowly for practical use.
Correlation-aware encodings. Exploit correlations between columns.
nameandname:*, as already supported by MLT.Data restructuring and conversion. Inspired by OpenZL's restructuring and conversion phase; for example, split
geometry into jump, free and residual streams, and evaluate semantic casts.
Shared data outside the tile. Move stable schema, metadata and common values into per-tileset dictionaries.
Index buffers. For pre-tessellated polygons and 3D, compare Edgebreaker-style connectivity coding with a
byte-oriented index codec designed for a following gzip or zstd stage, as used by meshoptimizer.
The following encodings should remain outside the web profile unless they demonstrate a net gain after compression: FSST, FastPFOR, rANS, most forms of RLE, bit-packing and more than one (or max two) boolean encodings. RLE may still help on exceptional streams with very long runs, but it should be retained only when measurement shows a gain. Delta-of-delta should not be an isolated encoding; where useful, it should be incorporated into the geometry predictor profiles.
All reactions