@@ -170,17 +170,6 @@ void QgsCoordinateTransform::initialise()
170
170
bool useDefaultDatumTransform = ( mSourceDatumTransform == - 1 && mDestinationDatumTransform == -1 );
171
171
172
172
// 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 () );
184
173
185
174
pj_free ( mSourceProjection );
186
175
QString sourceProjString = mSourceCRS .toProj4 ();
@@ -194,6 +183,22 @@ void QgsCoordinateTransform::initialise()
194
183
}
195
184
mSourceProjection = pj_init_plus ( sourceProjString.toUtf8 () );
196
185
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
+
197
202
#ifdef COORDINATE_TRANSFORM_VERBOSE
198
203
QgsDebugMsg ( " From proj : " + mSourceCRS .toProj4 () );
199
204
QgsDebugMsg ( " To proj : " + mDestCRS .toProj4 () );
0 commit comments