Skip to content

Commit 6cc5db3

Browse files
committedNov 1, 2013
Add null grid transformation if necessary
1 parent 63fbc75 commit 6cc5db3

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed
 

‎src/core/qgscoordinatetransform.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,6 @@ void QgsCoordinateTransform::initialise()
170170
bool useDefaultDatumTransform = ( mSourceDatumTransform == - 1 && mDestinationDatumTransform == -1 );
171171

172172
// init the projections (destination and source)
173-
pj_free( mDestinationProjection );
174-
QString destProjString = mDestCRS.toProj4();
175-
if ( !useDefaultDatumTransform )
176-
{
177-
destProjString = stripDatumTransform( destProjString );
178-
}
179-
if ( mDestinationDatumTransform != -1 )
180-
{
181-
destProjString += ( " " + datumTransformString( mDestinationDatumTransform ) );
182-
}
183-
mDestinationProjection = pj_init_plus( destProjString.toUtf8() );
184173

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

186+
pj_free( mDestinationProjection );
187+
QString destProjString = mDestCRS.toProj4();
188+
if ( !useDefaultDatumTransform )
189+
{
190+
destProjString = stripDatumTransform( destProjString );
191+
}
192+
if ( mDestinationDatumTransform != -1 )
193+
{
194+
destProjString += ( " " + datumTransformString( mDestinationDatumTransform ) );
195+
}
196+
else if ( sourceProjString.contains( "+nadgrids" ) ) //add null grid if source transformation is ntv2
197+
{
198+
destProjString += " +nadgrids=@null";
199+
}
200+
mDestinationProjection = pj_init_plus( destProjString.toUtf8() );
201+
197202
#ifdef COORDINATE_TRANSFORM_VERBOSE
198203
QgsDebugMsg( "From proj : " + mSourceCRS.toProj4() );
199204
QgsDebugMsg( "To proj : " + mDestCRS.toProj4() );

0 commit comments

Comments
 (0)
Please sign in to comment.