Skip to content
Permalink
Browse files

[raster] skip non finite values when computing band min/max statistics

(cherry-picked from 10044fb)
  • Loading branch information
nirvn authored and nyalldawson committed Mar 19, 2018
1 parent b1d485b commit 1e107ff5a524c35877a4c2b078672ccf72a9f6d2
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/core/raster/qgsrasterinterface.cpp
@@ -188,10 +188,11 @@ QgsRasterBandStats QgsRasterInterface::bandStatistics( int bandNo,
if ( blk->isNoData( i ) ) continue; // NULL

double myValue = blk->value( i );

myRasterBandStats.sum += myValue;
myRasterBandStats.elementCount++;

if ( !std::isfinite( myValue ) ) continue; // inf

if ( myFirstIterationFlag )
{
myFirstIterationFlag = false;

0 comments on commit 1e107ff

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