Comparing 32 bit and 16 bit elevation GeoPackages

From Maria GDK Wiki
Revision as of 12:52, 14 June 2024 by Mbu (talk | contribs)
Jump to navigation Jump to search

The tiled gridded coverage GeoPackage extension allows 32 bit source data to be converted to a GeoPackage with 16 bit integer tiles in PNG format, and still retain a significant number of decimals. This is accomplished by calculating a scale and offset for each tile, so that every tile utilizes the full space of the UInt16 data type (0-65536). Each tile is converted from float32 to UInt16 as follows:

offset = min(tile)

scale = (max(tile) - min(tile)) / (2^16 - 2)

tile_png = (tile - offset) / scale