Skip to content

Commit

Permalink
throw exception in case of search radius being smaller than sqrt(pixe…
Browse files Browse the repository at this point in the history
…lSize)/2.
  • Loading branch information
root676 authored and nyalldawson committed Jan 10, 2020
1 parent 670f367 commit bfe4e1a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/analysis/processing/qgsalgorithmlinedensity.cpp
Expand Up @@ -80,9 +80,14 @@ bool QgsLineDensityAlgorithm::prepareAlgorithm( const QVariantMap &parameters, Q
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "INPUT" ) ) );

mWeightField = parameterAsString( parameters, QStringLiteral( "WEIGHT" ), context );
mSearchRadius = parameterAsDouble( parameters, QStringLiteral( "RADIUS" ), context );

mPixelSize = parameterAsDouble( parameters, QStringLiteral( "PIXEL_SIZE" ), context );

mSearchRadius = parameterAsDouble( parameters, QStringLiteral( "RADIUS" ), context );
if ( mSearchRadius < std::sqrt( mPixelSize ) / 2 )
throw QgsProcessingException( QStringLiteral( "Raster cells must be fully contained by the search circle. Therefore, "
"the search radius must not be smaller than half of the pixel diagonal (half of square root of pixel size)." ) );

mExtent = mSource->sourceExtent();
mCrs = mSource->sourceCrs();

Expand Down

0 comments on commit bfe4e1a

Please sign in to comment.