Comparing 32 bit and 16 bit elevation GeoPackages: Difference between revisions

From Maria GDK Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
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).  
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:


<code>offset = min(tile)</code>
<code>
offset = min(tile)


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


<code>tile_png = (tile - offset) / scale</code>
tile_png = (tile - offset) / scale
</code>

Revision as of 12:52, 14 June 2024

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