diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-03-19 16:46:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-19 16:46:33 +0100 |
| commit | ac9c36e1b42475700c80410dd6d59f8c8f9db447 (patch) | |
| tree | 021265ad1d7de798428c6c1b4d06175002efe9be /src | |
| parent | bbdf037bc6a8715849b5c9e2a12441f7c86de8ba (diff) | |
| parent | 573d5ea0fd9eba8a73b96fc75326a7801b829288 (diff) | |
| download | PROJ-ac9c36e1b42475700c80410dd6d59f8c8f9db447.tar.gz PROJ-ac9c36e1b42475700c80410dd6d59f8c8f9db447.zip | |
Merge pull request #2589 from rouault/fix_2587
CRS::promoteTo3D(): propagate the extent from the 2D CRS (fixes #2587)
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso19111/crs.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp index 7c58640e..d7058a56 100644 --- a/src/iso19111/crs.cpp +++ b/src/iso19111/crs.cpp @@ -1002,6 +1002,24 @@ CRSNNPtr CRS::promoteTo3D(const std::string &newName, auto props = util::PropertyMap().set(common::IdentifiedObject::NAME_KEY, !newName.empty() ? newName : nameStr()); + const auto &l_domains = domains(); + if (!l_domains.empty()) { + auto array = util::ArrayOfBaseObject::create(); + for (const auto &domain : l_domains) { + auto extent = domain->domainOfValidity(); + if (extent) { + // Propagate only the extent, not the scope, as it might + // imply more that we can guarantee with the promotion to + // 3D. + auto newDomain = common::ObjectDomain::create( + util::optional<std::string>(), extent); + array->add(newDomain); + } + } + if (!array->empty()) { + props.set(common::ObjectUsage::OBJECT_DOMAIN_KEY, array); + } + } const auto &l_identifiers = identifiers(); if (l_identifiers.size() == 1) { std::string remarks("Promoted to 3D from "); |
