Skip to content

Commit f1527c7

Browse files
author
mhugent
committed
Write projection info to raster calculator output
git-svn-id: http://svn.osgeo.org/qgis/trunk@15581 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 313d349 commit f1527c7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/analysis/raster/qgsrastercalculator.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
110110
return 1;
111111
}
112112
GDALDatasetH outputDataset = openOutputFile( outputDriver );
113+
114+
//copy the projection info from the first input raster
115+
if ( mRasterEntries.size() > 0 )
116+
{
117+
QgsRasterLayer* rl = mRasterEntries.at( 0 ).raster;
118+
if ( rl )
119+
{
120+
//proj format would be better, but is not supported e.g. for writing to GeoTiff
121+
GDALSetProjection( outputDataset, TO8( rl->crs().toWkt() ) );
122+
}
123+
}
124+
125+
113126
GDALRasterBandH outputRasterBand = GDALGetRasterBand( outputDataset, 1 );
114127

115128
float outputNodataValue = -FLT_MAX;

0 commit comments

Comments
 (0)