Skip to content
Permalink
Browse files

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

  • Loading branch information
nyalldawson committed Apr 2, 2018
1 parent 1bf1058 commit cd052d3ba3c6f58726602df9b5984233bb1b1794
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/raster/qgsrasterlayer.cpp
@@ -540,7 +540,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();
}
@@ -549,7 +549,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 cd052d3

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