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
Raster block extent was based on intersection of raster vs
feature's bounding box, which was not necessarily snapped to
multiples of the pixel size. But the pixel center point/extent
was being calculated as though the retrieved extent was an
exact multiple of the pixel size. This led to incorrect
retrieval of pixel values.
pixel rectangles and polygons when doing exact statistics
calculations in zonal stats
Sppeds up zonal stats calculation by ~10x when pixel size
is large (compared to polygon sizes)
Fixes#18981 Save QLR crashes QGIS 3
This patch definitely prevents the crash but I'm not sure if
we should also introduce the same check in QgsLayerTree::isLayer
or even in QgsLayerTreeGroup::findLayers() or also when importing
a qlr that might lead to invalid layer (like in this
bug report).
This error hook should only ever be used from QGIS app, never
from standalone scripts and applications, so we should default
to not using it and only install it when initializing python
from app.
Otherwise default behavior for standalone scripts based on
PyQGIS is to silently swallow exceptions - this leaves script
developers *no clues* to go off to debug their applications,
meaning that errors which would usually take a couple of seconds
to fix become horrible exercises in frustration for those
unaware of QGIS' exception handling and the
QGIS_DISABLE_MESSAGE_HOOKS environment variable.
Refs #19111
Convert OGC Filter's literals accordings to field type.
This can have a huge impact on performance in some cases.
For example for a filter like "num_char" = '+2' converted to "num_char" = 2,
this result with PostgreSQL provider in a fallback to client side evaluation for the whole filter,
including the bbox if present.