Skip to content
Permalink
Browse files

Fix incorrect calculation of raster layer units per pixel x/y

(cherry-picked from cd052d3)
  • Loading branch information
nyalldawson committed Apr 6, 2018
1 parent 5a9fd0c commit 2e7990f19c7fea6fd530bef85e5a091ab071dfc8
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/raster/qgsrasterlayer.cpp
@@ -557,7 +557,7 @@ double QgsRasterLayer::rasterUnitsPerPixelX() const
// We can only use one of the mGeoTransform[], so go with the
// horisontal one.

if ( mDataProvider->capabilities() & QgsRasterDataProvider::Size && mDataProvider->xSize() > 0 )
if ( mDataProvider->capabilities() & QgsRasterDataProvider::Size && !qgsDoubleNear( mDataProvider->xSize(), 0.0 ) )
{
return mDataProvider->extent().width() / mDataProvider->xSize();
}
@@ -566,7 +566,7 @@ double QgsRasterLayer::rasterUnitsPerPixelX() const

double QgsRasterLayer::rasterUnitsPerPixelY() const
{
if ( mDataProvider->capabilities() & QgsRasterDataProvider::Size && mDataProvider->xSize() > 0 )
if ( mDataProvider->capabilities() & QgsRasterDataProvider::Size && !qgsDoubleNear( mDataProvider->ySize(), 0.0 ) )
{
return mDataProvider->extent().height() / mDataProvider->ySize();
}

0 comments on commit 2e7990f

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