Skip to content

Commit b9de4c4

Browse files
committed
Use compound crs workaround only on proj < 9.6
Upstream bug was fixed in OSGeo/PROJ#4333
1 parent f3b20de commit b9de4c4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/core/proj/qgscoordinatetransform.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,10 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle &r
637637
ProjData projData = d->threadLocalProjData();
638638
PJ_CONTEXT *projContext = QgsProjContext::get();
639639

640+
#if PROJ_VERSION_MAJOR< 9 || (PROJ_VERSION_MAJOR==9 && PROJ_VERSION_MINOR<6)
641+
// if source or destination crs include vertical components, we need to demote them to
642+
// 2d crs first, otherwise proj_trans_bounds fails on proj < 9.6 (see https://github.com/OSGeo/PROJ/pull/4333)
643+
640644
QgsProjUtils::proj_pj_unique_ptr srcCrs( proj_get_source_crs( projContext, projData ) );
641645
QgsProjUtils::proj_pj_unique_ptr destCrs( proj_get_target_crs( projContext, projData ) );
642646

@@ -646,13 +650,12 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle &r
646650
if ( QgsProjUtils::hasVerticalAxis( srcCrs.get() ) ||
647651
QgsProjUtils::hasVerticalAxis( destCrs.get() ) )
648652
{
649-
// if source or destination crs include vertical components, we need to demote them to
650-
// 2d crs first, otherwise proj_trans_bounds fails
651653
srcCrsHorizontal = QgsProjUtils::crsToHorizontalCrs( srcCrs.get() );
652654
destCrsHorizontal = QgsProjUtils::crsToHorizontalCrs( destCrs.get() );
653655
transform2D.reset( proj_create_crs_to_crs_from_pj( projContext, srcCrsHorizontal.get(), destCrsHorizontal.get(), nullptr, nullptr ) );
654656
projData = transform2D.get();
655657
}
658+
#endif
656659

657660
double transXMin = 0;
658661
double transYMin = 0;

0 commit comments

Comments
 (0)