Skip to content
Permalink
Browse files

PG raster: fix envelope and size rounding

  • Loading branch information
elpaso committed Mar 3, 2020
1 parent ea1826a commit 1e90f30a08e5280b266ce31231cc695b3a2c0c4e
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/providers/postgres/raster/qgspostgresrasterprovider.cpp
@@ -869,7 +869,7 @@ bool QgsPostgresRasterProvider::init()
// Try to determine extent from raster
const QString extentSql { QStringLiteral( "SELECT ST_Envelope( %1 ) "
"FROM %2 WHERE %3" )
.arg( quotedValue( mRasterColumn ) )
.arg( quotedIdentifier( mRasterColumn ) )
.arg( mQuery )
.arg( mSqlWhereClause.isEmpty() ? "'t'" : mSqlWhereClause ) };

@@ -915,8 +915,8 @@ bool QgsPostgresRasterProvider::init()
}

// Compute raster size
mHeight = static_cast<long>( mExtent.height() / std::abs( mScaleY ) );
mWidth = static_cast<long>( mExtent.width() / std::abs( mScaleX ) );
mHeight = static_cast<long>( std::round( mExtent.height() / std::abs( mScaleY ) ) );
mWidth = static_cast<long>( std::round( mExtent.width() / std::abs( mScaleX ) ) );
// is tiled?
mIsTiled = ( mWidth != mTileWidth ) || ( mHeight != mTileHeight );

0 comments on commit 1e90f30

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