ArchGDAL.jl icon indicating copy to clipboard operation
ArchGDAL.jl copied to clipboard

maximum not always maximum

Open visr opened this issue 4 years ago • 1 comments

In this post: https://discourse.julialang.org/t/get-true-maximum-value-of-a-raster/70622/2

I found out that ArchGDAL.maximum, does not do any computation, and just returns the typemax if it is not in the metadata.

https://github.com/yeesian/ArchGDAL.jl/blob/8f4ace3d927e7f634927a5cb59c605bcbbdffda0/src/raster/rasterband.jl#L225-L231 https://github.com/JuliaGeo/GDAL.jl/blob/3838e938642712cf8a98c52df5937dcfdb19221e/src/GDAL.jl#L8631-L8647

The C API docs only say "Fetch the maximum value for this band.", but the C++ docs actually explains this: https://gdal.org/api/gdalrasterband_cpp.html#classGDALRasterBand_1a6021d86aca5668bd10e4e4f3f1967ce5

Right now we don't use pbSuccess, but perhaps we should. Don't know how though. We could optionally return it, such that users can check it if they want. In any case we should document this behavior.

visr avatar Oct 29 '21 19:10 visr

Thanks for reporting this!

yeesian avatar Nov 01 '21 00:11 yeesian