Index: core/qgsvectorfilewriter.cpp =================================================================== --- core/qgsvectorfilewriter.cpp (revision 11374) +++ core/qgsvectorfilewriter.cpp (arbetskopia) @@ -30,6 +30,7 @@ #include #include #include +#include #include #include // size_t @@ -89,6 +90,7 @@ if ( srs ) { QString srsWkt = srs->toWkt(); + QgsDebugMsg( "WKT to save as is " + srsWkt ); ogrRef = OSRNewSpatialReference( srsWkt.toLocal8Bit().data() ); } @@ -379,6 +381,25 @@ { delete ct; } + + // Ohh, a great Hack-fest starts! + // Overwrite the .prj file created by QGsVectorFileWrite(). + QRegExp regExp( ".shp$" ); + QString prjName = shapefileName; + prjName.replace( regExp, QString( "" )); + prjName.append( QString( ".prj" ) ); + QFile prjFile( prjName ); + + if( !prjFile.open( QIODevice::WriteOnly ) ) + { + QgsDebugMsg( "Couldn't open file " + prjName ); + return NoError; // For now + } + + QTextStream prjStream( & prjFile ); + prjStream << destCRS->toWkt() << endl; + prjFile.close(); + return NoError; } Index: core/qgscoordinatereferencesystem.cpp =================================================================== --- core/qgscoordinatereferencesystem.cpp (revision 11374) +++ core/qgscoordinatereferencesystem.cpp (arbetskopia) @@ -1135,6 +1135,7 @@ QgsDebugMsg( "* Valid : " + ( mIsValidFlag ? QString( "true" ) : QString( "false" ) ) ); QgsDebugMsg( "* SrsId : " + QString::number( mSrsId ) ); QgsDebugMsg( "* Proj4 : " + toProj4() ); + QgsDebugMsg( "* WKT : " + toWkt() ); QgsDebugMsg( "* Desc. : " + mDescription ); if ( mapUnits() == QGis::Meters ) {