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(cogify): set zoom offsets for cogify to create smaller output files #3293

Closed blacha closed 2 months ago

blacha commented 2 months ago

Motivation

for some datasets we are overzooming them by a signficiant amount to align them to a output tile matrix zoom level.

For example a 1M DEM will be overzoomed to z18 0.59m, z17 is 1.19M it is closer to the 1M but is slightly lower quality.

By adding --base-zoom-offset=-1 we can force cogify to underzoom some datasets where to save storage space.

This can also be used with more zoom offsets to create signficantly smaller output files for a sample dataset whanganui_2022_0.075m which by default creats 20GB of COGs at z21.

By using -3 or -4 can greatly reduce the size of the dataset

114M    z17_whanganui_2022_0.075m (-4)
477M    z18_whanganui_2022_0.075m (-3)

Reducing Webp quality from 90% to 80% quality can additionally reduce the output file size even further. ~200MB for z18.

Modifications

Adds a configuration option --base-zoom-offset to allow configuration of the output COGs base zoom level. Adds a preset webp80 to reduce the quality target for webp from 90% to 80%

Verification

I have manually created many testing datasets with the new cogify to validate file sizes and image quality.