Skip to content

Commit

Permalink
PG raster: fix envelope and size rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Mar 3, 2020
1 parent ea1826a commit 1e90f30
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/providers/postgres/raster/qgspostgresrasterprovider.cpp
Expand Up @@ -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 ) };

Expand Down Expand Up @@ -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 );

Expand Down

0 comments on commit 1e90f30

Please sign in to comment.