I am looking for ArcGIS's dynamic range adjustment (DRA) analouge in QGIS for raster data sets. And I have found such button:
But I have to click it every time I move raster's extent.
There is any way to automate manual clicking the button?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
Nice find by @RoVo! There is also an alternative.
We could use a little bit of Python where each time the extent of the canvas changes, we connect the signal that is emitted to a function which triggers the button you mentioned.
So you could use something like the following in the Python Console:
from PyQt4.QtGui import QAction def stretch_raster(): try: layer = iface.activeLayer() if layer.type() == QgsMapLayer.RasterLayer: iface.mainWindow().findChild( QAction, 'mActionLocalCumulativeCutStretch' ).trigger() except AttributeError: pass iface.mapCanvas().extentsChanged.connect(stretch_raster)
Note that the button will only be triggered if a raster layer is selected from the Layers Panel. When you want to disconnect the signal from the function, you can use:
Unfortunately, this feature is not available without some python scripting, but will be available in 3.0.
@QGIS-feature-tracker QGIS-feature-tracker added this to the QGIS 3.0 milestone on Dec 16, 2016
To turn on ArcGIS's dynamic range adjustment (DRA) analouge in QGIS 3.12 go to:
Layer Properties =>
Min / Max Value Settings
Statistic extent to
How it works video (size - 20 MB).