mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Prevent background execution of zonal stats
This algorithm is NEVER safe to run in the background, because it directly modifies a layer in place. We should: - make a variant of this algorithm which returns a new layer AND - refactor the QgsZonalStats code to create a separate map of feature->stats, and then modify the existing Zonal Stats algorithm to apply these changes in a post processing step
This commit is contained in:
parent
6bf7c0eb92
commit
b637c7fe22
@ -32,6 +32,7 @@ from qgis.PyQt.QtGui import QIcon
|
||||
|
||||
from qgis.analysis import QgsZonalStatistics
|
||||
from qgis.core import (QgsProcessing,
|
||||
QgsProcessingAlgorithm,
|
||||
QgsProcessingParameterVectorLayer,
|
||||
QgsProcessingParameterRasterLayer,
|
||||
QgsProcessingParameterString,
|
||||
@ -61,6 +62,9 @@ class ZonalStatistics(QgisAlgorithm):
|
||||
def groupId(self):
|
||||
return 'rasteranalysis'
|
||||
|
||||
def flags(self):
|
||||
return super().flags() | QgsProcessingAlgorithm.FlagNoThreading
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.bandNumber = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user