Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

what about zstd compression? #1539

Unanswered
farfromrefug asked this question in Q&A
Discussion options

I am think about implementing zstd compression for tiles inside mbtiles.
I wanted to have your opinion on this first. Did any one try?
Would there be any drawback? It seems like zstd compression level 9 should be good to improve compression time/ratio and decompression time.

You must be logged in to vote

Replies: 1 comment 7 replies

Comment options

zstd has be become baseline widely avaliable in browsers in Feb 2026.
Given how slow users are to upgrade, I would not recomend deploying this to a browser -> https://caniuse.com/zstd

On mobile this might be different.

This opens the question:
Which renderer are you using? If maplibre, have you considered MLT?

You must be logged in to vote
7 replies
Comment options

@CommanderStorm i agree. Though file size for map data is a big question on mobile device (for offline use). So i always looking at reducing size even more.
zstd is a very fast compression, isn't ? I have no idea if zstd would even compress the MLT tile but it is something i would like to test

Comment options

zstd is a very fast compression, isn't

Faster than gzip, slower than not doing it.

I have no idea if zstd would even compress the MLT tile but it is something i would like to test

That is very simple to test, just dump the tiles to disk and run zstd.
Since you own your own rendering engine and likely server too, you might even be able to beat MLT by using your own, custom, data dependent ZSTD-dictionary.
Creating that dict is also work you will have to do though.

That being said, heavy weight compression is called that for a reason and on mobile especially you likely care about power consumption too.
Not having to tesselate on the client or decode zstd chunks where you don't need the entire chunk can be very handy.. hint, hint..

Comment options

@CommanderStorm thanks for the advises. I agree with your points. Will have to first run some tests on MLT to see how big of a difference it does compare to MVT

Comment options

Planetiler already supports --tile-compression=gzip (default) and --tile-compression=none for mvt and mlt but I think it would make sense to support zstd, broti, etc. too. Pmtiles supports all of these https://github.com/protomaps/PMTiles/blob/main/spec/v3/spec.md#33-compression but mbtiles is oddly hardcoded to gzip...? In any case this should be a pretty straightforward change in planetiler.

It woud be a little more work but also interesting to have planetiler generate a shared zstd dictionary automatically. I tried that with brotlil and saw a pretty large tile size decrease over mlt or mlt+gzip but the toolilng wasn't really practical to automate it. I think lightest-weight mlt (no fsst or fastpfor) + the best "heavyweight" compression algorithms are what's going to produce the overall smallest tile sizes.

Comment options

@msbarry thanks this is what i was thinking about. adding zstd as tile compression seemed a great idea.
I am a bit more reluctant with brotli as i did not find an easy way to "detect" brotli compression from the client side.
Can you at creating a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /