Write projection info to raster calculator output

git-svn-id: http://svn.osgeo.org/qgis/trunk@15581 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2011-03-23 16:08:19 +00:00
parent 313d349515
commit f1527c7f1a

View File

@ -110,6 +110,19 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
return 1;
}
GDALDatasetH outputDataset = openOutputFile( outputDriver );
//copy the projection info from the first input raster
if ( mRasterEntries.size() > 0 )
{
QgsRasterLayer* rl = mRasterEntries.at( 0 ).raster;
if ( rl )
{
//proj format would be better, but is not supported e.g. for writing to GeoTiff
GDALSetProjection( outputDataset, TO8( rl->crs().toWkt() ) );
}
}
GDALRasterBandH outputRasterBand = GDALGetRasterBand( outputDataset, 1 );
float outputNodataValue = -FLT_MAX;