[gdal-dev] GPKG: int16 with scale

Even Rouault even.rouault at spatialys.com
Mon Dec 10 06:59:18 PST 2018


On lundi 10 décembre 2018 16:29:09 CET Idan Miara wrote:
> Hi,
> 
> I'm trying unsuccessfully to save Int16 dataset with scale != 1.0 in GPKG.
> 
> If I understand correctly the remark about "Tiled gridded coverage data"
> here:
> https://www.gdal.org/drv_geopackage_raster.html
> I expect offset and scale for Int16 to be supported in gdal.
> 
> I tried to gdal_translate an int16 dataset from GTiff to GPKG and the scale
> value is lost (at lease as far as QGIS is concerned).
> I also translated the output gpkg back to GTiff and verified that the scale
> is 1.0 instead of 2.0 as in my original GTiff.

Yes, the Scale and Offset concepts as exposed by GDAL are ignored in reading 
or writing by the GeoPackage driver and haven't been mapped to the 
corresponding GPKG concepts. I guess this could be done, but for now the GPKG 
scale and offset have been kept as internal details when forcing a PNG 
encoding for a Float32 data type, and the driver will automatically set and 
apply scale and unscale, but not expose the raw values and the scale and 
offset metadata values.

For now, the solution is to use gdal_translate -unscale so as to convert the 
raw values into values after applying scale and offset.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list