Skip to content

Commit 16ad87e

Browse files
committedJul 21, 2017
Correctly create raster for heatmap output
Incorrect creation of geo transform was leading to invalid raster outputs and many "creating warped vrt" log messages (cherry-picked from 5241c74)
1 parent 0c335a2 commit 16ad87e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/plugins/heatmap/heatmap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void Heatmap::run()
149149
return;
150150
}
151151

152-
double geoTransform[6] = { myBBox.xMinimum(), cellsize, 0, myBBox.yMinimum(), 0, cellsize };
152+
double geoTransform[6] = { myBBox.xMinimum(), cellsize, 0, myBBox.yMaximum(), 0, -cellsize };
153153
GDALDatasetH emptyDataset = GDALCreate( myDriver, d.outputFilename().toUtf8(), columns, rows, 1, GDT_Float32, nullptr );
154154
GDALSetGeoTransform( emptyDataset, geoTransform );
155155
// Set the projection on the raster destination to match the input layer
@@ -293,7 +293,7 @@ void Heatmap::run()
293293
// calculate the pixel position
294294
unsigned int xPosition, yPosition;
295295
xPosition = ((( *pointIt ).x() - myBBox.xMinimum() ) / cellsize ) - myBuffer;
296-
yPosition = ((( *pointIt ).y() - myBBox.yMinimum() ) / cellsize ) - myBuffer;
296+
yPosition = (( myBBox.yMaximum() - ( *pointIt ).y() ) / cellsize ) - myBuffer;
297297

298298
// get the data
299299
float *dataBuffer = ( float * ) CPLMalloc( sizeof( float ) * blockSize * blockSize );

0 commit comments

Comments
 (0)
Please sign in to comment.