[QGIS-Developer] Wrong Output GetRasterband

Hauer Lukas lukas.hauer at josephinum.at
Mon Jul 23 02:37:30 PDT 2018


Hello!

I want to output the min and max of my layer properties via a python script. If I check it manually they are "Min 0.250754" and "Max 0.726268".
[cid:image001.png at 01D42279.12D3E1D0]

But my output via the python console is something completely different. With the GetMinimum method I receive 0.0837957039475 and with GetMaximum I receive 0.788260400295.

Script:
testlayer = iface.activeLayer()
dataset = gdal.Open(testlayer.source(), gdal.GA_ReadOnly)
band = dataset.GetRasterBand(1)

print "GDAL Min"
print band.GetMinimum()
print "GDAL Max"
print band.GetMaximum()

Output:
GDAL Min
0.0837957039475
GDAL Max
0.788260400295
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180723/12458ba4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 9821 bytes
Desc: image001.png
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180723/12458ba4/attachment-0001.png>


More information about the QGIS-Developer mailing list