aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-11-01 11:25:19 +0100
committerGitHub <noreply@github.com>2020-11-01 11:25:19 +0100
commit2d778088f1415993244d56ebd01f33dc753b6900 (patch)
treee908538ddaacc86133a366861efe1dcc6212f774
parent12274943fb88480686db0fc1cf3b13bde2d87845 (diff)
parent67718853e1248656cc35caa5a605ac102ec7e985 (diff)
downloadPROJ-2d778088f1415993244d56ebd01f33dc753b6900.tar.gz
PROJ-2d778088f1415993244d56ebd01f33dc753b6900.zip
Merge pull request #2401 from rouault/improve_remarks
Fill remarks on coordinate operations in more situations
-rw-r--r--src/iso19111/coordinateoperation.cpp70
-rw-r--r--test/cli/testprojinfo_out.dist15
-rw-r--r--test/unit/test_operation.cpp8
3 files changed, 87 insertions, 6 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index be15b3e0..e9d73f52 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -8836,11 +8836,16 @@ createSimilarPropertiesTransformation(TransformationNNPtr obj) {
// The domain(s) are unchanged
addDomains(map, obj.get());
- std::string forwardName = obj->nameStr();
+ const std::string &forwardName = obj->nameStr();
if (!forwardName.empty()) {
map.set(common::IdentifiedObject::NAME_KEY, forwardName);
}
+ const std::string &remarks = obj->remarks();
+ if (!remarks.empty()) {
+ map.set(common::IdentifiedObject::REMARKS_KEY, remarks);
+ }
+
addModifiedIdentifier(map, obj.get(), false, true);
return map;
@@ -12615,6 +12620,55 @@ createGeodToGeodPROJBased(const crs::CRSNNPtr &geodSrc,
// ---------------------------------------------------------------------------
+static std::string
+getRemarks(const std::vector<operation::CoordinateOperationNNPtr> &ops) {
+ std::string remarks;
+ for (const auto &op : ops) {
+ const auto &opRemarks = op->remarks();
+ if (!opRemarks.empty()) {
+ if (!remarks.empty()) {
+ remarks += '\n';
+ }
+
+ std::string opName(op->nameStr());
+ if (starts_with(opName, INVERSE_OF)) {
+ opName = opName.substr(INVERSE_OF.size());
+ }
+
+ remarks += "For ";
+ remarks += opName;
+
+ const auto &ids = op->identifiers();
+ if (!ids.empty()) {
+ std::string authority(*ids.front()->codeSpace());
+ if (starts_with(authority, "INVERSE(") &&
+ authority.back() == ')') {
+ authority = authority.substr(strlen("INVERSE("),
+ authority.size() - 1 -
+ strlen("INVERSE("));
+ }
+ if (starts_with(authority, "DERIVED_FROM(") &&
+ authority.back() == ')') {
+ authority = authority.substr(strlen("DERIVED_FROM("),
+ authority.size() - 1 -
+ strlen("DERIVED_FROM("));
+ }
+
+ remarks += " (";
+ remarks += authority;
+ remarks += ':';
+ remarks += ids.front()->code();
+ remarks += ')';
+ }
+ remarks += ": ";
+ remarks += opRemarks;
+ }
+ }
+ return remarks;
+}
+
+// ---------------------------------------------------------------------------
+
static CoordinateOperationNNPtr createHorizVerticalPROJBased(
const crs::CRSNNPtr &sourceCRS, const crs::CRSNNPtr &targetCRS,
const operation::CoordinateOperationNNPtr &horizTransform,
@@ -12640,6 +12694,10 @@ static CoordinateOperationNNPtr createHorizVerticalPROJBased(
properties.set(common::ObjectUsage::DOMAIN_OF_VALIDITY_KEY,
NN_NO_CHECK(extent));
}
+ const auto &remarks = verticalTransform->remarks();
+ if (!remarks.empty()) {
+ properties.set(common::IdentifiedObject::REMARKS_KEY, remarks);
+ }
return createPROJBased(
properties, exportable, sourceCRS, targetCRS, nullptr,
verticalTransform->coordinateOperationAccuracies(),
@@ -12664,6 +12722,11 @@ static CoordinateOperationNNPtr createHorizVerticalPROJBased(
NN_NO_CHECK(extent));
}
+ const auto remarks = getRemarks(ops);
+ if (!remarks.empty()) {
+ properties.set(common::IdentifiedObject::REMARKS_KEY, remarks);
+ }
+
std::vector<metadata::PositionalAccuracyNNPtr> accuracies;
const double accuracy = getAccuracy(ops);
if (accuracy >= 0.0) {
@@ -12724,6 +12787,11 @@ static CoordinateOperationNNPtr createHorizVerticalHorizPROJBased(
NN_NO_CHECK(extent));
}
+ const auto remarks = getRemarks(ops);
+ if (!remarks.empty()) {
+ properties.set(common::IdentifiedObject::REMARKS_KEY, remarks);
+ }
+
std::vector<metadata::PositionalAccuracyNNPtr> accuracies;
const double accuracy = getAccuracy(ops);
if (accuracy >= 0.0) {
diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist
index 245bb258..7da5add7 100644
--- a/test/cli/testprojinfo_out.dist
+++ b/test/cli/testprojinfo_out.dist
@@ -317,7 +317,8 @@ COORDINATEOPERATION["NAD27 to NAD83 (3)",
SCOPE["Historic record only - now superseded - see remarks."],
AREA["Canada - onshore and offshore - Alberta; British Columbia; Manitoba; New Brunswick; Newfoundland and Labrador; Northwest Territories; Nova Scotia; Nunavut; Ontario; Prince Edward Island; Quebec; Saskatchewan; Yukon."],
BBOX[40.04,-141.01,86.46,-47.74]],
- ID["DERIVED_FROM(EPSG)",1312]]
+ ID["DERIVED_FROM(EPSG)",1312],
+ REMARK["Uses NTv1 method. Replaced in Quebec by code 1462 and elsewhere in 1997 by NTv2 (transformation code 1313). Input expects longitudes to be positive west; EPSG GeogCRS NAD27 (code 4267) and NAD83 (code 4269) have longitudes positive east."]]
-------------------------------------
Operation No. 2:
@@ -371,7 +372,8 @@ COORDINATEOPERATION["NAD27 to NAD83 (4)",
SCOPE["Transformation of coordinates at 1m to 2m level of accuracy."],
AREA["Canada - onshore - Alberta; British Columbia; Manitoba; New Brunswick; Newfoundland and Labrador; Northwest Territories; Nova Scotia; Nunavut; Ontario; Prince Edward Island; Quebec; Saskatchewan; Yukon; offshore east coast."],
BBOX[40.04,-141.01,83.17,-47.74]],
- ID["DERIVED_FROM(EPSG)",1313]]
+ ID["DERIVED_FROM(EPSG)",1313],
+ REMARK["Uses NTv2 data files. Replaces NTv1 (transformation code 1312) except in Quebec. Input expects longitudes to be positive west; EPSG GeogCRS NAD27 (code 4267) and (code 4269) have longitudes positive east. May be used as tfm to WGS 84 - see code 1693."]]
-------------------------------------
Operation No. 3:
@@ -425,7 +427,8 @@ COORDINATEOPERATION["NAD27 to NAD83 (1)",
SCOPE["Transformation of coordinates at 0.2m level of accuracy."],
AREA["United States (USA) - CONUS including EEZ -onshore and offshore - Alabama; Arizona; Arkansas; California; Colorado; Connecticut; Delaware; Florida; Georgia; Idaho; Illinois; Indiana; Iowa; Kansas; Kentucky; Louisiana; Maine; Maryland; Massachusetts; Michigan; Minnesota; Mississippi; Missouri; Montana; Nebraska; Nevada; New Hampshire; New Jersey; New Mexico; New York; North Carolina; North Dakota; Ohio; Oklahoma; Oregon; Pennsylvania; Rhode Island; South Carolina; South Dakota; Tennessee; Texas; Utah; Vermont; Virginia; Washington; West Virginia; Wisconsin; Wyoming. US Gulf of Mexico (GoM) OCS."],
BBOX[23.81,-129.17,49.38,-65.69]],
- ID["DERIVED_FROM(EPSG)",1241]]
+ ID["DERIVED_FROM(EPSG)",1241],
+ REMARK["Uses NADCON method which expects longitudes positive west; EPSG GeogCRS NAD27 (code 4267) and NAD83 (code 4269) have longitudes positive east."]]
-------------------------------------
Operation No. 4:
@@ -479,7 +482,8 @@ COORDINATEOPERATION["NAD27 to NAD83 (2)",
SCOPE["Geodesy."],
AREA["United States (USA) - Alaska including EEZ."],
BBOX[47.88,167.65,74.71,-129.99]],
- ID["DERIVED_FROM(EPSG)",1243]]
+ ID["DERIVED_FROM(EPSG)",1243],
+ REMARK["Uses NADCON method which expects longitudes positive west; EPSG GeogCRS NAD27 (code 4267) and NAD83 (code 4269) have longitudes positive east. May be used as transformation to WGS 84 - see NAD27 to WGS 84 (85) (code 15864)."]]
-------------------------------------
Operation No. 5:
@@ -533,7 +537,8 @@ COORDINATEOPERATION["NAD27 to NAD83 (6)",
SCOPE["Transformation of coordinates at 1m to 2m level of accuracy."],
AREA["Canada - Quebec."],
BBOX[44.99,-79.85,62.62,-57.1]],
- ID["DERIVED_FROM(EPSG)",1573]]
+ ID["DERIVED_FROM(EPSG)",1573],
+ REMARK["Also distributed with file name QUE27-83.gsb. Replaces NAD27 to NAD83 (5) (code 1462). Uses NT method which expects longitudes positive west; EPSG GeogCRSs NAD27 (code 4267) and NAD83 (code 4269) have longitudes positive east."]]
-------------------------------------
Operation No. 6:
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index ce4b866b..1181b6d8 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -8734,6 +8734,14 @@ TEST(operation, compoundCRS_to_geogCRS_3D_context) {
"+multiplier=1 "
"+step +proj=unitconvert +xy_in=rad +xy_out=deg "
"+step +proj=axisswap +order=2,1");
+ EXPECT_EQ(list[0]->remarks(),
+ "For NAD83(NSRS2007) to NAVD88 height (1) (EPSG:9173): Uses "
+ "Geoid09 hybrid model. Replaced by 2012 model (CT code 6326)."
+ "\n"
+ "For NAD83(NSRS2007) to WGS 84 (1) (EPSG:15931): "
+ "Approximation at the +/- 1m level assuming that "
+ "NAD83(NSRS2007) is equivalent to WGS 84 within the accuracy "
+ "of the transformation.");
}
// NAD83 + NAVD88 height --> WGS 84