Skip to content

Commit

Permalink
Correctly create raster for heatmap output
Browse files Browse the repository at this point in the history
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 16ad87e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/heatmap/heatmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 16ad87e

Please sign in to comment.