Skip to content

Commit

Permalink
Add null grid transformation if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Nov 1, 2013
1 parent 63fbc75 commit 6cc5db3
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/core/qgscoordinatetransform.cpp
Expand Up @@ -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();
Expand All @@ -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() );
Expand Down

0 comments on commit 6cc5db3

Please sign in to comment.