Skip to content
Permalink
Browse files

Add null grid transformation if necessary

  • Loading branch information
mhugent committed Nov 1, 2013
1 parent 63fbc75 commit 6cc5db391092e21fa7ada1d0e1f55ccd457c4f45
Showing with 16 additions and 11 deletions.
  1. +16 −11 src/core/qgscoordinatetransform.cpp
@@ -170,17 +170,6 @@ void QgsCoordinateTransform::initialise()
bool useDefaultDatumTransform = ( mSourceDatumTransform == - 1 && mDestinationDatumTransform == -1 );

// init the projections (destination and source)
pj_free( mDestinationProjection );
QString destProjString = mDestCRS.toProj4();
if ( !useDefaultDatumTransform )
{
destProjString = stripDatumTransform( destProjString );
}
if ( mDestinationDatumTransform != -1 )
{
destProjString += ( " " + datumTransformString( mDestinationDatumTransform ) );
}
mDestinationProjection = pj_init_plus( destProjString.toUtf8() );

pj_free( mSourceProjection );
QString sourceProjString = mSourceCRS.toProj4();
@@ -194,6 +183,22 @@ void QgsCoordinateTransform::initialise()
}
mSourceProjection = pj_init_plus( sourceProjString.toUtf8() );

pj_free( mDestinationProjection );
QString destProjString = mDestCRS.toProj4();
if ( !useDefaultDatumTransform )
{
destProjString = stripDatumTransform( destProjString );
}
if ( mDestinationDatumTransform != -1 )
{
destProjString += ( " " + datumTransformString( mDestinationDatumTransform ) );
}
else if ( sourceProjString.contains( "+nadgrids" ) ) //add null grid if source transformation is ntv2
{
destProjString += " +nadgrids=@null";
}
mDestinationProjection = pj_init_plus( destProjString.toUtf8() );

#ifdef COORDINATE_TRANSFORM_VERBOSE
QgsDebugMsg( "From proj : " + mSourceCRS.toProj4() );
QgsDebugMsg( "To proj : " + mDestCRS.toProj4() );

0 comments on commit 6cc5db3

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