Skip to content
Permalink
Browse files

Write projection info to raster calculator output

git-svn-id: http://svn.osgeo.org/qgis/trunk@15581 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 23, 2011
1 parent 313d349 commit f1527c7f1a499f2e39d6ba93c0ffb930e8a5fd52
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/analysis/raster/qgsrastercalculator.cpp
@@ -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;

0 comments on commit f1527c7

Please sign in to comment.