On Mon, 23 Jul 2018 at 19:37, Hauer Lukas <[email protected]> wrote: > > 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“.
Which QGIS version? Check under the "load min/max values" group box to double check that you're using "min/max", and not "standard deviation" or some other method. > 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) This is GDAL api, not QGIS. If you want to try the QGIS way you should use: testlayer=iface.activeLayer() stats = testlayer.dataProvider().bandStatistics(1) print(stats.minimumValue) print(stats.maximumValue) Nyall _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
