aboutsummaryrefslogtreecommitdiff
path: root/src/coordinateoperation.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-12-22 14:09:58 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-12-22 14:09:58 +0100
commit0d706c2c8b703c0720f8fce120542e6f650ac6d7 (patch)
tree3172dd7b4cf14a83ba3f77a83f5b92596e2f85de /src/coordinateoperation.cpp
parentac6f0021a3ce6110e5a0a917aec9c0c614443e84 (diff)
downloadPROJ-0d706c2c8b703c0720f8fce120542e6f650ac6d7.tar.gz
PROJ-0d706c2c8b703c0720f8fce120542e6f650ac6d7.zip
Support Projected 3D with method name suffixed with ' (3D)', and be more lax on projection parameter names
Diffstat (limited to 'src/coordinateoperation.cpp')
-rw-r--r--src/coordinateoperation.cpp49
1 files changed, 44 insertions, 5 deletions
diff --git a/src/coordinateoperation.cpp b/src/coordinateoperation.cpp
index 98a2d830..442a9b78 100644
--- a/src/coordinateoperation.cpp
+++ b/src/coordinateoperation.cpp
@@ -159,6 +159,10 @@ static std::set<std::string> buildSetEquivalentParameters() {
EPSG_NAME_PARAMETER_NORTHING_FALSE_ORIGIN,
EPSG_NAME_PARAMETER_NORTHING_PROJECTION_CENTRE, nullptr},
+ {EPSG_NAME_PARAMETER_SCALE_FACTOR_AT_NATURAL_ORIGIN, WKT1_SCALE_FACTOR,
+ EPSG_NAME_PARAMETER_SCALE_FACTOR_INITIAL_LINE,
+ EPSG_NAME_PARAMETER_SCALE_FACTOR_PSEUDO_STANDARD_PARALLEL, nullptr},
+
{WKT1_LATITUDE_OF_ORIGIN, WKT1_LATITUDE_OF_CENTER,
EPSG_NAME_PARAMETER_LATITUDE_OF_NATURAL_ORIGIN,
EPSG_NAME_PARAMETER_LATITUDE_FALSE_ORIGIN,
@@ -826,7 +830,10 @@ OperationMethodNNPtr OperationMethod::create(
int OperationMethod::getEPSGCode() PROJ_CONST_DEFN {
int epsg_code = IdentifiedObject::getEPSGCode();
if (epsg_code == 0) {
- const auto &l_name = nameStr();
+ auto l_name = nameStr();
+ if (ends_with(l_name, " (3D)")) {
+ l_name.resize(l_name.size() - strlen(" (3D)"));
+ }
for (const auto &tuple : methodNameCodes) {
if (metadata::Identifier::isEquivalentName(l_name.c_str(),
tuple.name)) {
@@ -1268,6 +1275,14 @@ int OperationParameter::getEPSGCode() PROJ_CONST_DEFN {
return tuple.epsg_code;
}
}
+ if (metadata::Identifier::isEquivalentName(l_name.c_str(),
+ "Latitude of origin")) {
+ return EPSG_CODE_PARAMETER_LATITUDE_OF_NATURAL_ORIGIN;
+ }
+ if (metadata::Identifier::isEquivalentName(l_name.c_str(),
+ "Scale factor")) {
+ return EPSG_CODE_PARAMETER_SCALE_FACTOR_AT_NATURAL_ORIGIN;
+ }
}
return epsg_code;
}
@@ -1350,13 +1365,35 @@ static const ParameterValuePtr nullParameterValue;
const ParameterValuePtr &
SingleOperation::parameterValue(const std::string &paramName,
int epsg_code) const noexcept {
+ if (epsg_code) {
+ for (const auto &genOpParamvalue : parameterValues()) {
+ auto opParamvalue = dynamic_cast<const OperationParameterValue *>(
+ genOpParamvalue.get());
+ if (opParamvalue) {
+ const auto &parameter = opParamvalue->parameter();
+ if (parameter->getEPSGCode() == epsg_code) {
+ return opParamvalue->parameterValue();
+ }
+ }
+ }
+ }
+ for (const auto &genOpParamvalue : parameterValues()) {
+ auto opParamvalue = dynamic_cast<const OperationParameterValue *>(
+ genOpParamvalue.get());
+ if (opParamvalue) {
+ const auto &parameter = opParamvalue->parameter();
+ if (metadata::Identifier::isEquivalentName(
+ paramName.c_str(), parameter->nameStr().c_str())) {
+ return opParamvalue->parameterValue();
+ }
+ }
+ }
for (const auto &genOpParamvalue : parameterValues()) {
auto opParamvalue = dynamic_cast<const OperationParameterValue *>(
genOpParamvalue.get());
if (opParamvalue) {
const auto &parameter = opParamvalue->parameter();
- if ((epsg_code != 0 && parameter->getEPSGCode() == epsg_code) ||
- ci_equal(paramName, parameter->nameStr())) {
+ if (areEquivalentParameters(paramName, parameter->nameStr())) {
return opParamvalue->parameterValue();
}
}
@@ -5739,8 +5776,10 @@ bool Conversion::isUTM(int &zone, bool &north) const {
UTM_LATITUDE_OF_NATURAL_ORIGIN) < 1e-10) {
bLatitudeNatOriginUTM = true;
} else if (
- epsg_code ==
- EPSG_CODE_PARAMETER_LONGITUDE_OF_NATURAL_ORIGIN &&
+ (epsg_code ==
+ EPSG_CODE_PARAMETER_LONGITUDE_OF_NATURAL_ORIGIN ||
+ epsg_code ==
+ EPSG_CODE_PARAMETER_LONGITUDE_OF_ORIGIN) &&
measure.unit()._isEquivalentTo(
common::UnitOfMeasure::DEGREE,
util::IComparable::Criterion::EQUIVALENT)) {