Skip to content

Commit

Permalink
Bump minimum proj version to 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 30, 2022
1 parent c517d80 commit b852328
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 26 deletions.
2 changes: 1 addition & 1 deletion INSTALL.md
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindProj.cmake
Expand Up @@ -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}")
Expand Down
2 changes: 0 additions & 2 deletions src/core/proj/qgscoordinatetransform_p.cpp
Expand Up @@ -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 )
Expand Down
2 changes: 0 additions & 2 deletions src/core/proj/qgsprojutils.cpp
Expand Up @@ -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 );
Expand All @@ -178,7 +177,6 @@ bool QgsProjUtils::isDynamic( const PJ *crs )
}
}
}
#endif
return isDynamic;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/geometry/testqgscircularstring.cpp
Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/geometry/testqgscompoundcurve.cpp
Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/geometry/testqgsgeometrycollection.cpp
Expand Up @@ -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 ) );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/geometry/testqgslinestring.cpp
Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/geometry/testqgspoint.cpp
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/geometry/testqgspolygon.cpp
Expand Up @@ -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() );
Expand Down
2 changes: 0 additions & 2 deletions tests/src/core/testqgscoordinatereferencesystem.cpp
Expand Up @@ -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() );

Expand Down Expand Up @@ -1454,7 +1453,6 @@ void TestQgsCoordinateReferenceSystem::isDynamic()
AUTHORITY["EPSG","4326"]])""" ) ) );
QVERIFY( crs.isValid() );
QVERIFY( crs.isDynamic() );
#endif
}

void TestQgsCoordinateReferenceSystem::celestialBody()
Expand Down
4 changes: 0 additions & 4 deletions tests/src/core/testqgscoordinatetransform.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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<QgsCoordinateReferenceSystem>( "sourceCrs" );
Expand Down Expand Up @@ -558,7 +555,6 @@ void TestQgsCoordinateTransform::dynamicToDynamicErrorHandler()

QgsCoordinateTransform::setDynamicCrsToDynamicCrsWarningHandler( nullptr );
}
#endif

void TestQgsCoordinateTransform::transformBoundingBox()
{
Expand Down
6 changes: 0 additions & 6 deletions tests/src/core/testqgsprojutils.cpp
Expand Up @@ -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() );
Expand All @@ -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 )
Expand Down

0 comments on commit b852328

Please sign in to comment.