Skip to content

Commit

Permalink
Write projection info to raster calculator output
Browse files Browse the repository at this point in the history
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 f1527c7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/analysis/raster/qgsrastercalculator.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit f1527c7

Please sign in to comment.