Skip to content

Commit 267c80c

Browse files
wonder-sknyalldawson
authored andcommitted
[gdal] Fix raster block output when block extent is outside of valid area
This was causing problems in 3D view when raster was used as DEM... terrain tiles were generated also where they should not appear and contained random heights that caused failures of camera center adjustment to terrain. In the areas completely outside of raster's extent the block was being returned with some values uninitialized (instead of having correctly set no-data values) (cherry picked from commit afca644)
1 parent f260700 commit 267c80c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/providers/gdal/qgsgdalprovider.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,13 @@ QgsRasterBlock *QgsGdalProvider::block( int bandNo, const QgsRectangle &extent,
640640
return block;
641641
}
642642

643+
if ( !mExtent.intersects( extent ) )
644+
{
645+
// the requested extent is completely outside of the raster's extent - nothing to do
646+
block->setIsNoData();
647+
return block;
648+
}
649+
643650
if ( !mExtent.contains( extent ) )
644651
{
645652
QRect subRect = QgsRasterBlock::subRect( extent, width, height, mExtent );

0 commit comments

Comments
 (0)