aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-10-09 16:05:59 +0200
committerGitHub <noreply@github.com>2020-10-09 16:05:59 +0200
commita5dd7bbb8512a10280001491bd3fecc599fd4eca (patch)
treec5e3e11746ef7376f5d54d513bfefada2fb3c9a4
parentd83c7af5eea59eae366d61ea76d76118a8a505a0 (diff)
parentf0f9ec43e56a09dd4aaa6c25c9ea08ad09e4ecf8 (diff)
downloadPROJ-a5dd7bbb8512a10280001491bd3fecc599fd4eca.tar.gz
PROJ-a5dd7bbb8512a10280001491bd3fecc599fd4eca.zip
Merge pull request #2369 from rouault/fix_2368
promoteTo3D(): add a remark with the original CRS identifier (fixes #2368)
-rw-r--r--src/iso19111/crs.cpp26
-rw-r--r--test/cli/testprojinfo_out.dist3
2 files changed, 22 insertions, 7 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp
index ecbd39e1..e9082473 100644
--- a/src/iso19111/crs.cpp
+++ b/src/iso19111/crs.cpp
@@ -982,6 +982,22 @@ CRSNNPtr CRS::promoteTo3D(const std::string &newName,
const io::DatabaseContextPtr &dbContext,
const cs::CoordinateSystemAxisNNPtr
&verticalAxisIfNotAlreadyPresent) const {
+
+ const auto createProperties = [this, &newName]() {
+ auto props =
+ util::PropertyMap().set(common::IdentifiedObject::NAME_KEY,
+ !newName.empty() ? newName : nameStr());
+ const auto &l_identifiers = identifiers();
+ if (l_identifiers.size() == 1) {
+ std::string remarks("Promoted to 3D from ");
+ remarks += *(l_identifiers[0]->codeSpace());
+ remarks += ':';
+ remarks += l_identifiers[0]->code();
+ props.set(common::IdentifiedObject::REMARKS_KEY, remarks);
+ }
+ return props;
+ };
+
const auto geogCRS = dynamic_cast<const GeographicCRS *>(this);
if (geogCRS) {
const auto &axisList = geogCRS->coordinateSystem()->axisList();
@@ -1016,10 +1032,9 @@ CRSNNPtr CRS::promoteTo3D(const std::string &newName,
auto cs = cs::EllipsoidalCS::create(
util::PropertyMap(), axisList[0], axisList[1],
verticalAxisIfNotAlreadyPresent);
- return util::nn_static_pointer_cast<CRS>(GeographicCRS::create(
- util::PropertyMap().set(common::IdentifiedObject::NAME_KEY,
- !newName.empty() ? newName : nameStr()),
- geogCRS->datum(), geogCRS->datumEnsemble(), cs));
+ return util::nn_static_pointer_cast<CRS>(
+ GeographicCRS::create(createProperties(), geogCRS->datum(),
+ geogCRS->datumEnsemble(), cs));
}
}
@@ -1033,8 +1048,7 @@ CRSNNPtr CRS::promoteTo3D(const std::string &newName,
axisList[1],
verticalAxisIfNotAlreadyPresent);
return util::nn_static_pointer_cast<CRS>(ProjectedCRS::create(
- util::PropertyMap().set(common::IdentifiedObject::NAME_KEY,
- !newName.empty() ? newName : nameStr()),
+ createProperties(),
NN_NO_CHECK(
util::nn_dynamic_pointer_cast<GeodeticCRS>(base3DCRS)),
projCRS->derivingConversion(), cs));
diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist
index 5d36f42e..5373eb68 100644
--- a/test/cli/testprojinfo_out.dist
+++ b/test/cli/testprojinfo_out.dist
@@ -1021,7 +1021,8 @@ PROJCRS["WGS 84 / UTM zone 31N",
AXIS["ellipsoidal height (h)",up,
ORDER[3],
LENGTHUNIT["metre",1,
- ID["EPSG",9001]]]]
+ ID["EPSG",9001]]],
+ REMARK["Promoted to 3D from EPSG:32631"]]
Testing -s EPSG:32631 -t EPSG:4326+3855 --summary
Candidate operations found: 3