Skip to content
Browse files
[gdal] Fix raster block output when block extent is outside of valid …

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)
  • Loading branch information
wonder-sk authored and nyalldawson committed Nov 10, 2018
1 parent f260700 commit 267c80ccb4b8f4c6840227f017696939d3d83883
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/providers/gdal/qgsgdalprovider.cpp
@@ -640,6 +640,13 @@ QgsRasterBlock *QgsGdalProvider::block( int bandNo, const QgsRectangle &extent,
return block;

if ( !mExtent.intersects( extent ) )
// the requested extent is completely outside of the raster's extent - nothing to do
return block;

if ( !mExtent.contains( extent ) )
QRect subRect = QgsRasterBlock::subRect( extent, width, height, mExtent );

0 comments on commit 267c80c

Please sign in to comment.