From b8523282dc937ce3233d9a1521c7449c1315a730 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 30 Aug 2022 13:05:55 +1000 Subject: [PATCH] Bump minimum proj version to 7.2 --- INSTALL.md | 2 +- cmake/FindProj.cmake | 6 +++--- src/core/proj/qgscoordinatetransform_p.cpp | 2 -- src/core/proj/qgsprojutils.cpp | 2 -- tests/src/core/geometry/testqgscircularstring.cpp | 2 +- tests/src/core/geometry/testqgscompoundcurve.cpp | 2 +- tests/src/core/geometry/testqgsgeometrycollection.cpp | 2 +- tests/src/core/geometry/testqgslinestring.cpp | 2 +- tests/src/core/geometry/testqgspoint.cpp | 2 +- tests/src/core/geometry/testqgspolygon.cpp | 2 +- tests/src/core/testqgscoordinatereferencesystem.cpp | 2 -- tests/src/core/testqgscoordinatetransform.cpp | 4 ---- tests/src/core/testqgsprojutils.cpp | 6 ------ 13 files changed, 10 insertions(+), 26 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 0f5a724ce9d..ec24d9b5ab1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -100,7 +100,7 @@ Required build tools: Required build dependencies: * Qt >= 5.14.0 -* Proj >= 6.3.1 +* Proj >= 7.2.0 * GEOS >= 3.9 * Sqlite3 >= 3.0.0 * SpatiaLite >= 4.2.0 diff --git a/cmake/FindProj.cmake b/cmake/FindProj.cmake index ce9a7f35acf..d164a439e9a 100644 --- a/cmake/FindProj.cmake +++ b/cmake/FindProj.cmake @@ -63,9 +63,9 @@ IF (PROJ_FOUND) STRING(REGEX REPLACE "^.*PROJ_VERSION_MINOR +([0-9]+).*$" "\\1" PROJ_VERSION_MINOR "${proj_version}") STRING(REGEX REPLACE "^.*PROJ_VERSION_PATCH +([0-9]+).*$" "\\1" PROJ_VERSION_PATCH "${proj_version}") STRING(CONCAT PROJ_VERSION_STR "(" ${PROJ_VERSION_MAJOR} "." ${PROJ_VERSION_MINOR} "." ${PROJ_VERSION_PATCH} ")") - IF ((PROJ_VERSION_MAJOR EQUAL 6) AND ((PROJ_VERSION_MINOR LESS 3) OR (PROJ_VERSION_MINOR EQUAL 3 AND PROJ_VERSION_PATCH LESS 1))) - MESSAGE (FATAL_ERROR "Cannot build QGIS using Proj ${PROJ_VERSION_MAJOR}.${PROJ_VERSION_MINOR}.${PROJ_VERSION_PATCH} Use 6.3.1 or higher.") - ENDIF ((PROJ_VERSION_MAJOR EQUAL 6) AND ((PROJ_VERSION_MINOR LESS 3) OR (PROJ_VERSION_MINOR EQUAL 3 AND PROJ_VERSION_PATCH LESS 1))) + IF ((PROJ_VERSION_MAJOR EQUAL 7) AND ((PROJ_VERSION_MINOR LESS 2) OR (PROJ_VERSION_MAJOR LESS 7))) + MESSAGE (FATAL_ERROR "Cannot build QGIS using Proj ${PROJ_VERSION_MAJOR}.${PROJ_VERSION_MINOR}.${PROJ_VERSION_PATCH} Use 7.2.0 or higher.") + ENDIF ((PROJ_VERSION_MAJOR EQUAL 7) AND ((PROJ_VERSION_MINOR LESS 2) OR (PROJ_VERSION_MAJOR LESS 7))) ELSE(EXISTS ${PROJ_INCLUDE_DIR}/proj.h AND EXISTS ${PROJ_INCLUDE_DIR}/proj_experimental.h) FILE(READ ${PROJ_INCLUDE_DIR}/proj_api.h proj_version) STRING(REGEX REPLACE "^.*PJ_VERSION ([0-9]+).*$" "\\1" PJ_VERSION "${proj_version}") diff --git a/src/core/proj/qgscoordinatetransform_p.cpp b/src/core/proj/qgscoordinatetransform_p.cpp index 61e83f4c2a2..139a0262f9f 100644 --- a/src/core/proj/qgscoordinatetransform_p.cpp +++ b/src/core/proj/qgscoordinatetransform_p.cpp @@ -301,11 +301,9 @@ ProjData QgsCoordinateTransformPrivate::threadLocalProjData() // When networking is not enabled, proj_create() will check that all grids are // present, so proj_coordoperation_is_instantiable() is not necessary. if ( !transform -#if PROJ_VERSION_MAJOR >= 7 || ( proj_context_is_network_enabled( context ) && !proj_coordoperation_is_instantiable( context, transform.get() ) ) -#endif ) { if ( sMissingGridUsedByContextHandler ) diff --git a/src/core/proj/qgsprojutils.cpp b/src/core/proj/qgsprojutils.cpp index 262db80b830..13758c73ba5 100644 --- a/src/core/proj/qgsprojutils.cpp +++ b/src/core/proj/qgsprojutils.cpp @@ -163,7 +163,6 @@ bool QgsProjUtils::isDynamic( const PJ *crs ) } } } -#if PROJ_VERSION_MAJOR > 7 || (PROJ_VERSION_MAJOR == 7 && PROJ_VERSION_MINOR >= 2) else { proj_pj_unique_ptr ensemble( horiz ? proj_crs_get_datum_ensemble( context, horiz.get() ) : nullptr ); @@ -178,7 +177,6 @@ bool QgsProjUtils::isDynamic( const PJ *crs ) } } } -#endif return isDynamic; } diff --git a/tests/src/core/geometry/testqgscircularstring.cpp b/tests/src/core/geometry/testqgscircularstring.cpp index 9426b0ea396..dd2151ea156 100644 --- a/tests/src/core/geometry/testqgscircularstring.cpp +++ b/tests/src/core/geometry/testqgscircularstring.cpp @@ -968,7 +968,7 @@ void TestQgsCircularString::crsTransform() QGSCOMPARENEAR( cs.pointN( 1 ).z(), 3, 0.001 ); QCOMPARE( cs.pointN( 1 ).m(), 4.0 ); -#if PROJ_VERSION_MAJOR<6 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions +#if 0 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions //z value transform cs.transform( tr, Qgis::TransformDirection::Forward, true ); diff --git a/tests/src/core/geometry/testqgscompoundcurve.cpp b/tests/src/core/geometry/testqgscompoundcurve.cpp index eaea80a0635..e2938fa54ba 100644 --- a/tests/src/core/geometry/testqgscompoundcurve.cpp +++ b/tests/src/core/geometry/testqgscompoundcurve.cpp @@ -2713,7 +2713,7 @@ void TestQgsCompoundCurve::crs3dTransformAndReverse() QGSCOMPARENEAR( pt.z(), 5.0, 0.001 ); QCOMPARE( pt.m(), 6.0 ); -#if PROJ_VERSION_MAJOR<6 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions +#if 0 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions //z value transform cc.transform( tr, Qgis::TransformDirection::Forward, true ); diff --git a/tests/src/core/geometry/testqgsgeometrycollection.cpp b/tests/src/core/geometry/testqgsgeometrycollection.cpp index 6601c1ead4f..323484a05cf 100644 --- a/tests/src/core/geometry/testqgsgeometrycollection.cpp +++ b/tests/src/core/geometry/testqgsgeometrycollection.cpp @@ -667,7 +667,7 @@ void TestQgsGeometryCollection::geometryCollection() QGSCOMPARENEAR( intR->boundingBox().xMaximum(), 6474984, 100 ); QGSCOMPARENEAR( intR->boundingBox().yMaximum(), -3526584, 100 ); -#if PROJ_VERSION_MAJOR<6 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions +#if 0 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions //z value transform pTransform.transform( tr, Qgis::TransformDirection::Forward, true ); extR = static_cast< const QgsLineString * >( pTransform.geometryN( 0 ) ); diff --git a/tests/src/core/geometry/testqgslinestring.cpp b/tests/src/core/geometry/testqgslinestring.cpp index c2ab25f64b3..1b5be5013f9 100644 --- a/tests/src/core/geometry/testqgslinestring.cpp +++ b/tests/src/core/geometry/testqgslinestring.cpp @@ -1411,7 +1411,7 @@ void TestQgsLineString::CRSTransform() QGSCOMPARENEAR( ls.pointN( 1 ).z(), 3, 0.001 ); QCOMPARE( ls.pointN( 1 ).m(), 4.0 ); -#if PROJ_VERSION_MAJOR<6 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions +#if 0 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions //z value transform ls.transform( tr, Qgis::TransformDirection::Forward, true ); diff --git a/tests/src/core/geometry/testqgspoint.cpp b/tests/src/core/geometry/testqgspoint.cpp index ccc8137cf0e..1eab77599ad 100644 --- a/tests/src/core/geometry/testqgspoint.cpp +++ b/tests/src/core/geometry/testqgspoint.cpp @@ -1010,7 +1010,7 @@ void TestQgsPoint::crsTransform() QGSCOMPARENEAR( pt.z(), 1.0, 0.001 ); QCOMPARE( pt.m(), 2.0 ); -#if PROJ_VERSION_MAJOR<6 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions +#if 0 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions //test with z transform pt.transform( tr, Qgis::TransformDirection::Forward, true ); QGSCOMPARENEAR( pt.z(), -19.249, 0.001 ); diff --git a/tests/src/core/geometry/testqgspolygon.cpp b/tests/src/core/geometry/testqgspolygon.cpp index 9e63a85bab5..0cefa5749ef 100644 --- a/tests/src/core/geometry/testqgspolygon.cpp +++ b/tests/src/core/geometry/testqgspolygon.cpp @@ -2463,7 +2463,7 @@ void TestQgsPolygon::transformOldVersion() pl.setExteriorRing( ls.clone() ); pl.addInteriorRing( ls.clone() ); -#if PROJ_VERSION_MAJOR<6 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions +#if 0 // note - z value transform doesn't currently work with proj 6+, because we don't yet support compound CRS definitions //z value transform pl.transform( tr, Qgis::TransformDirection::Forward, true ); const QgsLineString *ext = static_cast< const QgsLineString * >( pl.exteriorRing() ); diff --git a/tests/src/core/testqgscoordinatereferencesystem.cpp b/tests/src/core/testqgscoordinatereferencesystem.cpp index ae40042417f..ac772c8ae39 100644 --- a/tests/src/core/testqgscoordinatereferencesystem.cpp +++ b/tests/src/core/testqgscoordinatereferencesystem.cpp @@ -1425,7 +1425,6 @@ void TestQgsCoordinateReferenceSystem::mapUnits() void TestQgsCoordinateReferenceSystem::isDynamic() { -#if (PROJ_VERSION_MAJOR>7 || (PROJ_VERSION_MAJOR==7 && PROJ_VERSION_MINOR >= 2 ) ) QgsCoordinateReferenceSystem crs( QStringLiteral( "EPSG:7665" ) ); QVERIFY( crs.isDynamic() ); @@ -1454,7 +1453,6 @@ void TestQgsCoordinateReferenceSystem::isDynamic() AUTHORITY["EPSG","4326"]])""" ) ) ); QVERIFY( crs.isValid() ); QVERIFY( crs.isDynamic() ); -#endif } void TestQgsCoordinateReferenceSystem::celestialBody() diff --git a/tests/src/core/testqgscoordinatetransform.cpp b/tests/src/core/testqgscoordinatetransform.cpp index e5dbf1bc7c6..f7e3540473d 100644 --- a/tests/src/core/testqgscoordinatetransform.cpp +++ b/tests/src/core/testqgscoordinatetransform.cpp @@ -42,11 +42,9 @@ class TestQgsCoordinateTransform: public QObject void scaleFactor_data(); void transform_data(); void transform(); -#if PROJ_VERSION_MAJOR>7 || (PROJ_VERSION_MAJOR == 7 && PROJ_VERSION_MINOR >= 2) void transformEpoch_data(); void transformEpoch(); void dynamicToDynamicErrorHandler(); -#endif void transformLKS(); void transformContextNormalize(); void transform2DPoint(); @@ -400,7 +398,6 @@ void TestQgsCoordinateTransform::transform() QGSCOMPARENEAR( y, outY, precision ); } -#if PROJ_VERSION_MAJOR>7 || (PROJ_VERSION_MAJOR == 7 && PROJ_VERSION_MINOR >= 2) void TestQgsCoordinateTransform::transformEpoch_data() { QTest::addColumn( "sourceCrs" ); @@ -558,7 +555,6 @@ void TestQgsCoordinateTransform::dynamicToDynamicErrorHandler() QgsCoordinateTransform::setDynamicCrsToDynamicCrsWarningHandler( nullptr ); } -#endif void TestQgsCoordinateTransform::transformBoundingBox() { diff --git a/tests/src/core/testqgsprojutils.cpp b/tests/src/core/testqgsprojutils.cpp index c3170b2e16c..922c05a23b3 100644 --- a/tests/src/core/testqgsprojutils.cpp +++ b/tests/src/core/testqgsprojutils.cpp @@ -105,7 +105,6 @@ void TestQgsProjUtils::gridsUsed() // ensure local user-writable path is present in Proj search paths QList< QgsDatumTransform::GridDetails > grids = QgsProjUtils::gridsUsed( QStringLiteral( "+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +inv +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1" ) ); QCOMPARE( grids.count(), 1 ); -#if PROJ_VERSION_MAJOR>=7 QCOMPARE( grids.at( 0 ).shortName, QStringLiteral( "GDA94_GDA2020_conformal_and_distortion.gsb" ) ); QVERIFY( grids.at( 0 ).directDownload ); QVERIFY( !grids.at( 0 ).url.isEmpty() ); @@ -115,11 +114,6 @@ void TestQgsProjUtils::gridsUsed() QCOMPARE( grids.at( 0 ).shortName, QStringLiteral( "au_icsm_GDA94_GDA2020_conformal_and_distortion.tif" ) ); QVERIFY( grids.at( 0 ).directDownload ); QVERIFY( !grids.at( 0 ).url.isEmpty() ); -#else - QCOMPARE( grids.at( 0 ).shortName, QStringLiteral( "GDA94_GDA2020_conformal_and_distortion.gsb" ) ); - QCOMPARE( grids.at( 0 ).packageName, QStringLiteral( "proj-datumgrid-oceania" ) ); - QVERIFY( grids.at( 0 ).directDownload ); -#endif } QGSTEST_MAIN( TestQgsProjUtils )