aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2019-05-01 18:42:13 +0200
committerGitHub <noreply@github.com>2019-05-01 18:42:13 +0200
commitfc48053092b4b6f496bb983765ebf619a356e257 (patch)
tree2c53161326b766dc41e4733ce6579503fc702384 /test/unit
parente168ad31badb6702240174250894a76385da323b (diff)
parenteeda5f7e5fd94a0cdcbf90df1f0b04a090f4c037 (diff)
downloadPROJ-fc48053092b4b6f496bb983765ebf619a356e257.tar.gz
PROJ-fc48053092b4b6f496bb983765ebf619a356e257.zip
Merge branch 'master' into check_exported_symbols
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/test_io.cpp37
-rw-r--r--test/unit/test_operation.cpp45
2 files changed, 82 insertions, 0 deletions
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index df2481e6..294e765d 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -5180,6 +5180,43 @@ TEST(wkt_parse, wkt1_esri_ups_south) {
// ---------------------------------------------------------------------------
+TEST(wkt_parse, wkt1_esri_gauss_kruger) {
+ auto wkt = "PROJCS[\"ETRS_1989_UWPP_2000_PAS_8\",GEOGCS[\"GCS_ETRS_1989\","
+ "DATUM[\"D_ETRS_1989\","
+ "SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],"
+ "PRIMEM[\"Greenwich\",0.0],"
+ "UNIT[\"Degree\",0.0174532925199433]],"
+ "PROJECTION[\"Gauss_Kruger\"],"
+ "PARAMETER[\"False_Easting\",8500000.0],"
+ "PARAMETER[\"False_Northing\",0.0],"
+ "PARAMETER[\"Central_Meridian\",24.0],"
+ "PARAMETER[\"Scale_Factor\",0.999923],"
+ "PARAMETER[\"Latitude_Of_Origin\",0.0],"
+ "UNIT[\"Meter\",1.0]]";
+
+ auto dbContext = DatabaseContext::create();
+ auto obj = WKTParser().attachDatabaseContext(dbContext).createFromWKT(wkt);
+ auto crs = nn_dynamic_pointer_cast<ProjectedCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+
+ EXPECT_EQ(
+ crs->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext)
+ .get()),
+ wkt);
+
+ auto crs2 = AuthorityFactory::create(dbContext, "ESRI")
+ ->createProjectedCRS("102177");
+
+ EXPECT_EQ(
+ crs2->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext)
+ .get()),
+ wkt);
+}
+
+// ---------------------------------------------------------------------------
+
TEST(wkt_parse, invalid) {
EXPECT_THROW(WKTParser().createFromWKT(""), ParsingException);
EXPECT_THROW(WKTParser().createFromWKT("A"), ParsingException);
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index b7b87d76..a38e9df2 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -5396,6 +5396,39 @@ TEST(operation, projCRS_to_projCRS_context_incompatible_areas) {
// ---------------------------------------------------------------------------
+TEST(operation, projCRS_to_projCRS_context_incompatible_areas_ballpark) {
+ auto authFactory =
+ AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0);
+ auto list = CoordinateOperationFactory::create()->createOperations(
+ authFactory->createCoordinateReferenceSystem("26711"), // UTM 11 NAD27
+ authFactory->createCoordinateReferenceSystem(
+ "3034"), // ETRS89 / LCC Europe
+ ctxt);
+ ASSERT_GE(list.size(), 1U);
+ EXPECT_TRUE(list[0]->hasBallparkTransformation());
+}
+
+// ---------------------------------------------------------------------------
+
+TEST(
+ operation,
+ projCRS_to_projCRS_context_incompatible_areas_crs_extent_use_intersection) {
+ auto authFactory =
+ AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0);
+ ctxt->setSourceAndTargetCRSExtentUse(
+ CoordinateOperationContext::SourceTargetCRSExtentUse::INTERSECTION);
+ auto list = CoordinateOperationFactory::create()->createOperations(
+ authFactory->createCoordinateReferenceSystem("26711"), // UTM 11 NAD27
+ authFactory->createCoordinateReferenceSystem(
+ "3034"), // ETRS89 / LCC Europe
+ ctxt);
+ ASSERT_GE(list.size(), 0U);
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, projCRS_to_projCRS_north_pole_inverted_axis) {
auto authFactory =
@@ -6444,6 +6477,18 @@ TEST(operation, compoundCRS_to_compoundCRS_context) {
"+step +proj=hgridshift +grids=conus +step "
"+proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap "
"+order=2,1");
+ {
+ // Test that we can round-trip this through WKT and still get the same
+ // PROJ string.
+ auto wkt = list[0]->exportToWKT(
+ WKTFormatter::create(WKTFormatter::Convention::WKT2_2018).get());
+ auto obj = WKTParser().createFromWKT(wkt);
+ auto co = nn_dynamic_pointer_cast<CoordinateOperation>(obj);
+ ASSERT_TRUE(co != nullptr);
+ EXPECT_EQ(
+ list[0]->exportToPROJString(PROJStringFormatter::create().get()),
+ co->exportToPROJString(PROJStringFormatter::create().get()));
+ }
bool foundApprox = false;
for (size_t i = 0; i < list.size(); i++) {