aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-10-12 10:58:55 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-10-12 10:58:55 +0200
commit4387332ea628282570d712d5b4b6dccc2ea5e604 (patch)
tree6ee6f4dc7f403fe38479c7eaf915c9e8e61be3c6 /test/unit
parent6a877010114b7ccc12d017989500fa5f12f9e39c (diff)
downloadPROJ-4387332ea628282570d712d5b4b6dccc2ea5e604.tar.gz
PROJ-4387332ea628282570d712d5b4b6dccc2ea5e604.zip
Fix export to WKT1:ESRI of CRS, datum, ellipsoids name that don't have a EPSG equivalent and have parentheses in their name
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/test_crs.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp
index 987ffe1b..d55a8c6e 100644
--- a/test/unit/test_crs.cpp
+++ b/test/unit/test_crs.cpp
@@ -747,6 +747,46 @@ TEST(crs, EPSG_4268_geogcrs_deprecated_as_WKT1_GDAL) {
// ---------------------------------------------------------------------------
+TEST(crs, ESRI_104971_as_WKT1_ESRI_with_database) {
+ auto dbContext = DatabaseContext::create();
+ auto factory = AuthorityFactory::create(dbContext, "ESRI");
+ auto crs = factory->createCoordinateReferenceSystem("104971");
+ WKTFormatterNNPtr f(WKTFormatter::create(
+ WKTFormatter::Convention::WKT1_ESRI, DatabaseContext::create()));
+ // Check that the _(Sphere) suffix is preserved
+ EXPECT_EQ(crs->exportToWKT(f.get()),
+ "GEOGCS[\"Mars_2000_(Sphere)\",DATUM[\"Mars_2000_(Sphere)\","
+ "SPHEROID[\"Mars_2000_(Sphere)\",3396190.0,0.0]],"
+ "PRIMEM[\"Reference_Meridian\",0.0],"
+ "UNIT[\"Degree\",0.0174532925199433]]");
+}
+
+// ---------------------------------------------------------------------------
+
+TEST(crs,
+ implicit_compound_ESRI_104024_plus_115844_as_WKT1_ESRI_with_database) {
+ auto dbContext = DatabaseContext::create();
+ auto obj = createFromUserInput("ESRI:104024+115844", dbContext);
+ auto crs = nn_dynamic_pointer_cast<GeographicCRS>(obj);
+ ASSERT_TRUE(crs != nullptr);
+ EXPECT_EQ(crs->coordinateSystem()->axisList().size(), 3U);
+ WKTFormatterNNPtr f(WKTFormatter::create(
+ WKTFormatter::Convention::WKT1_ESRI, DatabaseContext::create()));
+ // Situation where there is no EPSG official name
+ EXPECT_EQ(crs->exportToWKT(f.get()),
+ "GEOGCS[\"California_SRS_Epoch_2017.50_(NAD83)\","
+ "DATUM[\"California_SRS_Epoch_2017.50_(NAD83)\","
+ "SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],"
+ "PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],"
+ "VERTCS[\"California_SRS_Epoch_2017.50_(NAD83)\","
+ "DATUM[\"California_SRS_Epoch_2017.50_(NAD83)\","
+ "SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],"
+ "PARAMETER[\"Vertical_Shift\",0.0],"
+ "PARAMETER[\"Direction\",1.0],UNIT[\"Meter\",1.0]]");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(crs, IAU_1000_as_WKT2) {
auto dbContext = DatabaseContext::create();
auto factory = AuthorityFactory::create(dbContext, "IAU_2015");
@@ -3877,6 +3917,23 @@ TEST(crs, verticalCRS_down_as_WKT1_ESRI) {
// ---------------------------------------------------------------------------
+TEST(crs, verticalCRS_ESRI_115834_as_WKT1_ESRI_with_database) {
+ auto dbContext = DatabaseContext::create();
+ auto factory = AuthorityFactory::create(dbContext, "ESRI");
+ auto crs = factory->createCoordinateReferenceSystem("115834");
+ WKTFormatterNNPtr f(WKTFormatter::create(
+ WKTFormatter::Convention::WKT1_ESRI, DatabaseContext::create()));
+ // Check that the parentheses in the VERTCS and DATUM names are preserved
+ EXPECT_EQ(crs->exportToWKT(f.get()),
+ "VERTCS[\"NAD83(CSRS)v5\","
+ "DATUM[\"North_American_Datum_of_1983_(CSRS)_version_5\","
+ "SPHEROID[\"GRS_1980\",6378137.0,298.257222101]],"
+ "PARAMETER[\"Vertical_Shift\",0.0],"
+ "PARAMETER[\"Direction\",1.0],UNIT[\"Meter\",1.0]]");
+}
+
+// ---------------------------------------------------------------------------
+
TEST(crs, verticalCRS_identify_db) {
auto dbContext = DatabaseContext::create();
auto factory = AuthorityFactory::create(dbContext, "EPSG");