Skip to content
Permalink
Browse files

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
  • Loading branch information
nyalldawson committed Jun 8, 2018
1 parent 6bf7c0e commit b637c7fe22583dbc40162551e10feb6f872d1241
Showing with 4 additions and 0 deletions.
  1. +4 −0 python/plugins/processing/algs/qgis/ZonalStatistics.py
@@ -32,6 +32,7 @@

from qgis.analysis import QgsZonalStatistics
from qgis.core import (QgsProcessing,
QgsProcessingAlgorithm,
QgsProcessingParameterVectorLayer,
QgsProcessingParameterRasterLayer,
QgsProcessingParameterString,
@@ -61,6 +62,9 @@ def group(self):
def groupId(self):
return 'rasteranalysis'

def flags(self):
return super().flags() | QgsProcessingAlgorithm.FlagNoThreading

def __init__(self):
super().__init__()
self.bandNumber = None

0 comments on commit b637c7f

Please sign in to comment.
You can’t perform that action at this time.