Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[raster] skip non finite values when computing band min/max statistics
  • Loading branch information
nirvn committed Mar 16, 2018
1 parent 975117a commit 10044fb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/raster/qgsrasterinterface.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 10044fb

Please sign in to comment.