Skip to content
Permalink
Browse files

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)
  • Loading branch information
nyalldawson committed Jul 21, 2017
1 parent 0c335a2 commit 16ad87e8ed47e7e5cdf0ac4a04aa01dbdeb8e72f
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/plugins/heatmap/heatmap.cpp
@@ -149,7 +149,7 @@ void Heatmap::run()
return;
}

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

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

0 comments on commit 16ad87e

Please sign in to comment.
You can’t perform that action at this time.