Skip to content
Permalink
Browse files

assign CRS to interpolation output (fix #3578)

  • Loading branch information
alexbruy authored and mhugent committed Mar 27, 2014
1 parent 344383b commit 34421c896fa5c7a0e8161576d9c9ecee9eeb86ad
Showing with 20 additions and 1 deletion.
  1. +19 −0 src/analysis/interpolation/qgsgridfilewriter.cpp
  2. +1 −1 src/analysis/interpolation/qgsinterpolator.h
@@ -17,7 +17,9 @@

#include "qgsgridfilewriter.h"
#include "qgsinterpolator.h"
#include "qgsvectorlayer.h"
#include <QFile>
#include <QFileInfo>
#include <QProgressDialog>

QgsGridFileWriter::QgsGridFileWriter( QgsInterpolator* i, QString outputPath, QgsRectangle extent, int nCols, int nRows , double cellSizeX, double cellSizeY )
@@ -96,6 +98,23 @@ int QgsGridFileWriter::writeFile( bool showProgressDialog )
}
}

// create prj file
QgsInterpolator::LayerData ld;
ld = mInterpolator->mLayerData.first();
QgsVectorLayer* vl = ld.vectorLayer;
QString crs = vl->crs().toWkt();
QFileInfo fi( mOutputFilePath );
QString fileName = fi.absolutePath() + "/" + fi.completeBaseName() + ".prj";
QFile prjFile( fileName );
if ( !prjFile.open( QFile::WriteOnly ) )
{
return 1;
}
QTextStream prjStream( &prjFile );
prjStream << crs;
prjStream << endl;
prjFile.close();

delete progressDialog;
return 0;
}
@@ -87,7 +87,7 @@ class ANALYSIS_EXPORT QgsInterpolator
@return 0 in case of success*/
int addVerticesToCache( QgsGeometry* geom, bool zCoord, double attributeValue );


friend class QgsGridFileWriter;
};

#endif

0 comments on commit 34421c8

Please sign in to comment.
You can’t perform that action at this time.