aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-04-22 13:15:02 +0200
committerEven Rouault <even.rouault@spatialys.com>2019-04-22 15:49:31 +0200
commitd8526d7870e4b91238c9a7b652ed03c21b77e884 (patch)
treeccd8cfe10d750f60bc81050f42847f218855dcb5
parente63f206d994658995505ce322d644fba0b807d5b (diff)
downloadPROJ-d8526d7870e4b91238c9a7b652ed03c21b77e884.tar.gz
PROJ-d8526d7870e4b91238c9a7b652ed03c21b77e884.zip
ESRI_WKT: preserve Gauss_Kruger in conversion name for round-tripping
-rw-r--r--src/iso19111/c_api.cpp3
-rw-r--r--src/iso19111/coordinateoperation.cpp9
-rw-r--r--src/iso19111/io.cpp5
-rw-r--r--test/unit/test_io.cpp37
4 files changed, 48 insertions, 6 deletions
diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp
index 8fea51e9..6a2a1ae0 100644
--- a/src/iso19111/c_api.cpp
+++ b/src/iso19111/c_api.cpp
@@ -5964,7 +5964,8 @@ int proj_coordoperation_get_param(
* @param out_values Pointer to an array of value_count double values.
* @param value_count Size of out_values array. The suggested size is 7 to get
* translation, rotation and scale difference parameters. Rotation and scale
- * difference terms might be zero if the transformation only includes translation
+ * difference terms might be zero if the transformation only includes
+ * translation
* parameters. In that case, value_count could be set to 3.
* @param emit_error_if_incompatible Boolean to inicate if an error must be
* logged if coordoperation is not compatible with a WKT1 TOWGS84
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index 7eab849c..0b4e7912 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -5120,10 +5120,11 @@ static void getESRIMethodNameAndParams(const Conversion *conv,
}
} else if (esriMapping->epsg_code ==
EPSG_CODE_METHOD_TRANSVERSE_MERCATOR) {
- if (l_targetCRS &&
- (ci_find(l_targetCRS->nameStr(), "Gauss") !=
- std::string::npos ||
- ci_find(l_targetCRS->nameStr(), "GK_") != std::string::npos)) {
+ if (ci_find(conv->nameStr(), "Gauss Kruger") != std::string::npos ||
+ (l_targetCRS && (ci_find(l_targetCRS->nameStr(), "Gauss") !=
+ std::string::npos ||
+ ci_find(l_targetCRS->nameStr(), "GK_") !=
+ std::string::npos))) {
esriParams = paramsESRI_Gauss_Kruger;
esriMethodName = "Gauss_Kruger";
} else {
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index 360d55a2..399908eb 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -3257,7 +3257,10 @@ ConversionNNPtr WKTParser::Private::buildProjectionFromESRI(
}
return Conversion::create(
- PropertyMap().set(IdentifiedObject::NAME_KEY, "unnamed"),
+ PropertyMap().set(IdentifiedObject::NAME_KEY,
+ esriProjectionName == "Gauss_Kruger"
+ ? "unnnamed (Gauss Kruger)"
+ : "unnamed"),
propertiesMethod, parameters, values)
->identify();
}
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index 30e0b427..c4178f20 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);