Skip to content
Permalink
Browse files

Add some proj6 test branches

(cherry picked from commit cdc9a84)
  • Loading branch information
nyalldawson committed Dec 19, 2019
1 parent 394cbb3 commit 1d505d0e566264a8084e62ac674bd81b5d92bb34
Showing with 17 additions and 0 deletions.
  1. +4 −0 tests/src/core/testqgsdistancearea.cpp
  2. +13 −0 tests/src/core/testqgsgdalutils.cpp
@@ -341,7 +341,11 @@ void TestQgsDistanceArea::measureAreaAndUnits()
poly << ring;
polygon = QgsGeometry::fromPolygonXY( poly );

#if PROJ_VERSION_MAJOR>=6
da.setSourceCrs( QgsCoordinateReferenceSystem( QStringLiteral( "ESRI:102635" ) ), QgsProject::instance()->transformContext() );
#else
da.setSourceCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:102635" ) ), QgsProject::instance()->transformContext() );
#endif
da.setEllipsoid( QStringLiteral( "NONE" ) );
// measurement should be in square feet
area = da.measureArea( polygon );
@@ -105,7 +105,11 @@ void TestQgsGdalUtils::testCreateSingleBandMemoryDataset()
QCOMPARE( GDALGetRasterXSize( ds1.get() ), 40 );
QCOMPARE( GDALGetRasterYSize( ds1.get() ), 20 );

#if PROJ_VERSION_MAJOR>=6
QCOMPARE( GDALGetProjectionRef( ds1.get() ), QStringLiteral( R"""(GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]])""" ) );
#else
QCOMPARE( GDALGetProjectionRef( ds1.get() ), EPSG_4326_WKT );
#endif
double geoTransform[6];
double geoTransformExpected[] = { 1, 0.5, 0, 11, 0, -0.5 };
QCOMPARE( GDALGetGeoTransform( ds1.get(), geoTransform ), CE_None );
@@ -123,7 +127,11 @@ void TestQgsGdalUtils::testCreateMultiBandMemoryDataset()
QCOMPARE( GDALGetRasterXSize( ds1.get() ), 40 );
QCOMPARE( GDALGetRasterYSize( ds1.get() ), 20 );

#if PROJ_VERSION_MAJOR>=6
QCOMPARE( GDALGetProjectionRef( ds1.get() ), QStringLiteral( R"""(GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]])""" ) );
#else
QCOMPARE( GDALGetProjectionRef( ds1.get() ), EPSG_4326_WKT );
#endif
double geoTransform[6];
double geoTransformExpected[] = { 1, 0.5, 0, 11, 0, -0.5 };
QCOMPARE( GDALGetGeoTransform( ds1.get(), geoTransform ), CE_None );
@@ -148,7 +156,12 @@ void TestQgsGdalUtils::testCreateSingleBandTiffDataset()
QCOMPARE( GDALGetRasterXSize( ds1.get() ), 40 );
QCOMPARE( GDALGetRasterYSize( ds1.get() ), 20 );

#if PROJ_VERSION_MAJOR>=6
QCOMPARE( GDALGetProjectionRef( ds1.get() ), QStringLiteral( R"""(GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]])""" ) );
#else
QCOMPARE( GDALGetProjectionRef( ds1.get() ), EPSG_4326_WKT );
#endif

double geoTransform[6];
double geoTransformExpected[] = { 1, 0.5, 0, 11, 0, -0.5 };
QCOMPARE( GDALGetGeoTransform( ds1.get(), geoTransform ), CE_None );

0 comments on commit 1d505d0

Please sign in to comment.
You can’t perform that action at this time.