diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2018-12-03 16:44:21 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2018-12-03 16:44:21 +0100 |
| commit | ba111ac8323ff194039a06db87d1fb17ed8175b3 (patch) | |
| tree | 176a946244be38963714bc75984803655ebdd4a8 /test/unit/test_crs.cpp | |
| parent | 2d8f295354ce20f2d375a985ff48fd5e7f8b90ca (diff) | |
| download | PROJ-ba111ac8323ff194039a06db87d1fb17ed8175b3.tar.gz PROJ-ba111ac8323ff194039a06db87d1fb17ed8175b3.zip | |
Export to ESRI WKT: make it use verbatim WKT definition from the database when possible
Diffstat (limited to 'test/unit/test_crs.cpp')
| -rw-r--r-- | test/unit/test_crs.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp index 74f85d50..3f044de0 100644 --- a/test/unit/test_crs.cpp +++ b/test/unit/test_crs.cpp @@ -1685,6 +1685,60 @@ TEST(crs, projectedCRS_as_WKT1_ESRI) { // --------------------------------------------------------------------------- +TEST(crs, projectedCRS_with_ESRI_code_as_WKT1_ESRI) { + auto dbContext = DatabaseContext::create(); + auto crs = AuthorityFactory::create(dbContext, "ESRI") + ->createProjectedCRS("102113"); + + // Comes literally from the text_definition column of + // projected_crs table + auto esri_wkt = + "PROJCS[\"WGS_1984_Web_Mercator\"," + "GEOGCS[\"GCS_WGS_1984_Major_Auxiliary_Sphere\"," + "DATUM[\"D_WGS_1984_Major_Auxiliary_Sphere\"," + "SPHEROID[\"WGS_1984_Major_Auxiliary_Sphere\",6378137.0,0.0]]," + "PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]," + "PROJECTION[\"Mercator\"],PARAMETER[\"False_Easting\",0.0]," + "PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0]," + "PARAMETER[\"Standard_Parallel_1\",0.0],UNIT[\"Meter\",1.0]]"; + + EXPECT_EQ( + crs->exportToWKT( + WKTFormatter::create(WKTFormatter::Convention::WKT1_ESRI, dbContext) + .get()), + esri_wkt); +} + +// --------------------------------------------------------------------------- + +TEST(crs, projectedCRS_from_WKT1_ESRI_as_WKT1_ESRI) { + auto dbContext = DatabaseContext::create(); + // Comes literally from the text_definition column of + // projected_crs table + auto esri_wkt = + "PROJCS[\"WGS_1984_Web_Mercator\"," + "GEOGCS[\"GCS_WGS_1984_Major_Auxiliary_Sphere\"," + "DATUM[\"D_WGS_1984_Major_Auxiliary_Sphere\"," + "SPHEROID[\"WGS_1984_Major_Auxiliary_Sphere\",6378137.0,0.0]]," + "PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]," + "PROJECTION[\"Mercator\"],PARAMETER[\"False_Easting\",0.0]," + "PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0]," + "PARAMETER[\"Standard_Parallel_1\",0.0],UNIT[\"Meter\",1.0]]"; + + auto obj = + WKTParser().attachDatabaseContext(dbContext).createFromWKT(esri_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()), + esri_wkt); +} + +// --------------------------------------------------------------------------- + TEST(crs, projectedCRS_as_PROJ_string) { auto crs = createProjected(); EXPECT_EQ(crs->exportToPROJString(PROJStringFormatter::create().get()), |
