linz / basemaps

NZ’s authoritative and open digital basemap service for LINZ and the public.
https://basemaps.linz.govt.nz
Other
92 stars 16 forks source link

feat(tiler-sharp): reducde the z precision of terrain-rgb to generate much smaller tiles for low z levels BM-1002 #3276

Closed blacha closed 2 months ago

blacha commented 2 months ago

Motivation

Terrain RGB tiles can be quite large at low (z0-z10) zoom levels the blue channel of the terrainRGB represents around 25M of vertical accuracy, when viewing tiles where 1 pixel is 1,000m sub meter accurarcy is not required.

from initial test cases this can reude the tile size by 50%+

tile z_x_y Before After Bytes saved % reduction
03_7_4 3,607 2,737 -870 -24.12%
04_15_9 7,802 4,305 -3,497 -44.82%
05_31_19 23,031 8,872 -14,159 -61.48%
06_63_39 64,024 23,827 -40,197 -62.78%
07_126_79 110,251 45,738 -64,513 -58.51%
08_252_159 66,791 28,809 -37,982 -56.87%
09_505_319 125,658 64,711 -60,947 -48.50%
10_1010_639 143,054 91,446 -51,608 -36.08%
11_2020_1278 98,940 62,342 -36,598 -36.99%
12_4040_2556 29,740 29,740 0 0

Modification

Truncates the terrainRGB blue channel down to greatly reduce the file size of the output tiles.

Checklist

If not applicable, provide explanation of why.