Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRS::promoteTo3D(): propagate the extent from the 2D CRS (fixes #2587) #2589

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/iso19111/crs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ");
Expand Down
4 changes: 4 additions & 0 deletions test/cli/testprojinfo_out.dist
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,10 @@ PROJCRS["WGS 84 / UTM zone 31N",
ORDER[3],
LENGTHUNIT["metre",1,
ID["EPSG",9001]]],
USAGE[
SCOPE["unknown"],
AREA["Between 0°E and 6°E, northern hemisphere between equator and 84°N, onshore and offshore. Algeria. Andorra. Belgium. Benin. Burkina Faso. Denmark - North Sea. France. Germany - North Sea. Ghana. Luxembourg. Mali. Netherlands. Niger. Nigeria. Norway. Spain. Togo. United Kingdom (UK) - North Sea."],
BBOX[0,0,84,6]],
REMARK["Promoted to 3D from EPSG:32631"]]

Testing -s EPSG:32631 -t EPSG:4326+3855 --summary
Expand Down