-
-
Notifications
You must be signed in to change notification settings - Fork 184
what about zstd compression? #1539
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 7 replies
-
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?
Beta Was this translation helpful? Give feedback.
All reactions
-
@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
Beta Was this translation helpful? Give feedback.
All reactions
-
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..
Beta Was this translation helpful? Give feedback.
All reactions
-
@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
Beta Was this translation helpful? Give feedback.
All reactions
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
@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
Beta Was this translation helpful? Give feedback.