[gdal-dev] GDAL can't read values from new raster dataset, but Global Mapper can
Even Rouault
even.rouault at spatialys.com
Mon Sep 30 03:51:17 PDT 2019
On lundi 30 septembre 2019 03:42:32 CEST CDelancy wrote:
> Hello. I am using GDAL 3 in a c++ project. I have found that GDAL does not
> seem to properly read values from raster datasets that it has created. For
> example, if I create a new raster dataset with one band and read the min and
> max values from that band, it always returns -4294967295.0 and
> 4294967295.0.
With which API ? With GetMinimum() and GetMaximum() ? In that case, that's the documented behaviour:
https://gdal.org/api/gdalrasterband_cpp.html#classGDALRasterBand_1a70e048ffc6b33cea685897ce8068a7e8
"""
Fetch the minimum value for this band.
For file formats that don’t know this intrinsically, the minimum supported value for the data type will generally be returned.
"""
Look at ComputeStatistics() or ComputeRasterMinMax():
https://gdal.org/api/gdalrasterband_cpp.html#_CPPv4N14GDALRasterBand17ComputeStatisticsEiPdPdPdPd16GDALProgressFuncPv
https://gdal.org/api/gdalrasterband_cpp.html#_CPPv4N14GDALRasterBand19ComputeRasterMinMaxEiPd
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list