aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-03-23 18:34:09 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-03-24 10:18:17 +0100
commit23d2941ef30f5fa62230606766ae8b9e296f814f (patch)
tree042a08df700fa054bf4fd0d476ce527f08bcdb5a /src
parent9af705d630b0cd629daa0b8a28b82ba28752aa7d (diff)
downloadPROJ-23d2941ef30f5fa62230606766ae8b9e296f814f.tar.gz
PROJ-23d2941ef30f5fa62230606766ae8b9e296f814f.zip
ESRI WKT import / identification: special case for NAD_1983_HARN_StatePlane_Colorado_North_FIPS_0501 with Foot_US unit (fixes #2086)
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/coordinateoperation.cpp2
-rw-r--r--src/iso19111/io.cpp39
2 files changed, 31 insertions, 10 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index 63b11761..33210d24 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -2443,7 +2443,7 @@ bool ParameterValue::_isEquivalentTo(const util::IComparable *other,
}
switch (type()) {
case Type::MEASURE: {
- return value()._isEquivalentTo(otherPV->value(), criterion);
+ return value()._isEquivalentTo(otherPV->value(), criterion, 2e-10);
}
case Type::STRING:
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index c57014d9..6a1d7e32 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -3689,6 +3689,15 @@ WKTParser::Private::buildProjectedCRS(const WKTNodeNNPtr &node) {
auto props = buildProperties(node);
+ auto &csNode = nodeP->lookForChild(WKTConstants::CS_);
+ const auto &nodeValue = nodeP->value();
+ if (isNull(csNode) && !ci_equal(nodeValue, WKTConstants::PROJCS) &&
+ !ci_equal(nodeValue, WKTConstants::BASEPROJCRS)) {
+ ThrowMissing(WKTConstants::CS_);
+ }
+ auto cs = buildCS(csNode, node, UnitOfMeasure::NONE);
+ auto cartesianCS = nn_dynamic_pointer_cast<CartesianCS>(cs);
+
const std::string projCRSName = stripQuotes(nodeP->children()[0]);
if (esriStyle_ && dbContext_) {
// It is likely that the ESRI definition of EPSG:32661 (UPS North) &
@@ -3709,6 +3718,27 @@ WKTParser::Private::buildProjectedCRS(const WKTNodeNNPtr &node) {
projCRSName, "projected_crs", "ESRI", false, outTableName,
authNameFromAlias, codeFromAlias);
if (!officialName.empty()) {
+ // Special case for https://github.com/OSGeo/PROJ/issues/2086
+ // The name of the CRS to identify is
+ // NAD_1983_HARN_StatePlane_Colorado_North_FIPS_0501
+ // whereas it should be
+ // NAD_1983_HARN_StatePlane_Colorado_North_FIPS_0501_Feet
+ constexpr double US_FOOT_CONV_FACTOR = 12.0 / 39.37;
+ if (projCRSName.find("_FIPS_") != std::string::npos &&
+ projCRSName.find("_Feet") == std::string::npos &&
+ std::fabs(
+ cartesianCS->axisList()[0]->unit().conversionToSI() -
+ US_FOOT_CONV_FACTOR) < 1e-10 * US_FOOT_CONV_FACTOR) {
+ auto officialNameFromFeet =
+ authFactory->getOfficialNameFromAlias(
+ projCRSName + "_Feet", "projected_crs", "ESRI",
+ false, outTableName, authNameFromAlias,
+ codeFromAlias);
+ if (!officialNameFromFeet.empty()) {
+ officialName = officialNameFromFeet;
+ }
+ }
+
props.set(IdentifiedObject::NAME_KEY, officialName);
}
}
@@ -3739,15 +3769,6 @@ WKTParser::Private::buildProjectedCRS(const WKTNodeNNPtr &node) {
? buildConversion(conversionNode, linearUnit, angularUnit)
: buildProjection(node, projectionNode, linearUnit, angularUnit);
- auto &csNode = nodeP->lookForChild(WKTConstants::CS_);
- const auto &nodeValue = nodeP->value();
- if (isNull(csNode) && !ci_equal(nodeValue, WKTConstants::PROJCS) &&
- !ci_equal(nodeValue, WKTConstants::BASEPROJCRS)) {
- ThrowMissing(WKTConstants::CS_);
- }
- auto cs = buildCS(csNode, node, UnitOfMeasure::NONE);
- auto cartesianCS = nn_dynamic_pointer_cast<CartesianCS>(cs);
-
// No explicit AXIS node ? (WKT1)
if (isNull(nodeP->lookForChild(WKTConstants::AXIS))) {
props.set("IMPLICIT_CS", true);