Skip to content

Commit

Permalink
Fix calculation of pixel diagonal half-length - qgsalgorithmlinedensi…
Browse files Browse the repository at this point in the history
…ty.cpp
  • Loading branch information
havatv committed Feb 19, 2020
1 parent 69c4013 commit 144dfbe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/analysis/processing/qgsalgorithmlinedensity.cpp
Expand Up @@ -84,9 +84,9 @@ bool QgsLineDensityAlgorithm::prepareAlgorithm( const QVariantMap &parameters, Q
mPixelSize = parameterAsDouble( parameters, QStringLiteral( "PIXEL_SIZE" ), context );

mSearchRadius = parameterAsDouble( parameters, QStringLiteral( "RADIUS" ), context );
if ( mSearchRadius < std::sqrt( mPixelSize ) / 2 )
if ( mSearchRadius < 0.5 * mPixelSize * std::sqrt( 2 ) )
throw QgsProcessingException( QObject::tr( "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)." ) );
"the search radius must not be smaller than half of the pixel diagonal." ) );

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

0 comments on commit 144dfbe

Please sign in to comment.