On Thu, 26 Jul 2018 at 08:45, Nyall Dawson <nyall.daw...@gmail.com> wrote:
> 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)

Just to expand on that - if you use pure PyQGIS API instead of mixing
in the gdal API here, then your code will work correctly regardless of
the layer source (e.g. it will work for wms/mapserver/etc, not just
gdal file based layers)

Nyall
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to