Skip to content

Commit 1e90f30

Browse files
committedMar 3, 2020
PG raster: fix envelope and size rounding
1 parent ea1826a commit 1e90f30

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/providers/postgres/raster/qgspostgresrasterprovider.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ bool QgsPostgresRasterProvider::init()
869869
// Try to determine extent from raster
870870
const QString extentSql { QStringLiteral( "SELECT ST_Envelope( %1 ) "
871871
"FROM %2 WHERE %3" )
872-
.arg( quotedValue( mRasterColumn ) )
872+
.arg( quotedIdentifier( mRasterColumn ) )
873873
.arg( mQuery )
874874
.arg( mSqlWhereClause.isEmpty() ? "'t'" : mSqlWhereClause ) };
875875

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.