Skip to content
Permalink
Browse files

throw exception in case of search radius being smaller than sqrt(pixe…

…lSize)/2.
  • Loading branch information
root676 authored and nyalldawson committed Jan 2, 2020
1 parent 670f367 commit bfe4e1ab9609992564a3933c9a6873adb2fb5247
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/analysis/processing/qgsalgorithmlinedensity.cpp
@@ -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();

0 comments on commit bfe4e1a

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