Skip to content

Commit 282ef29

Browse files
committed
Small optimisation for zstats so that we dont do more expensive geoemtry operation when we know that cell value is null already.
1 parent 3c5980c commit 282ef29

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/analysis/vector/qgszonalstatistics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ void QgsZonalStatistics::statisticsFromMiddlePointTest( void* band, QgsGeometry*
306306
GEOSCoordSeq_setY( cellCenterCoords, 0, cellCenterY );
307307
currentCellCenter = GEOSGeom_createPoint( cellCenterCoords );
308308

309-
if ( GEOSPreparedContains( polyGeosPrepared, currentCellCenter ) )
309+
if ( scanLine[j] != mInputNodataValue ) //don't consider nodata values
310310
{
311-
if ( scanLine[j] != mInputNodataValue ) //don't consider nodata values
311+
if ( GEOSPreparedContains( polyGeosPrepared, currentCellCenter ) )
312312
{
313313
sum += scanLine[j];
314314
++count;

0 commit comments

Comments
 (0)