diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/coordinateoperation.cpp | 27 | ||||
| -rw-r--r-- | src/io.cpp | 12 |
2 files changed, 36 insertions, 3 deletions
diff --git a/src/coordinateoperation.cpp b/src/coordinateoperation.cpp index a1f305bf..ac170bbf 100644 --- a/src/coordinateoperation.cpp +++ b/src/coordinateoperation.cpp @@ -1503,10 +1503,35 @@ bool SingleOperation::_isEquivalentTo(const util::IComparable *other, const int methodEPSGCode = d->method_->getEPSGCode(); const int otherMethodEPSGCode = otherSO->d->method_->getEPSGCode(); - const bool equivalentMethods = + bool equivalentMethods = (criterion == util::IComparable::Criterion::EQUIVALENT && methodEPSGCode != 0 && methodEPSGCode == otherMethodEPSGCode) || d->method_->_isEquivalentTo(otherSO->d->method_.get(), criterion); + if (!equivalentMethods && + criterion == util::IComparable::Criterion::EQUIVALENT) { + if ((methodEPSGCode == EPSG_CODE_METHOD_LAMBERT_AZIMUTHAL_EQUAL_AREA && + otherMethodEPSGCode == + EPSG_CODE_METHOD_LAMBERT_AZIMUTHAL_EQUAL_AREA_SPHERICAL) || + (otherMethodEPSGCode == + EPSG_CODE_METHOD_LAMBERT_AZIMUTHAL_EQUAL_AREA && + methodEPSGCode == + EPSG_CODE_METHOD_LAMBERT_AZIMUTHAL_EQUAL_AREA_SPHERICAL) || + (methodEPSGCode == EPSG_CODE_METHOD_EQUIDISTANT_CYLINDRICAL && + otherMethodEPSGCode == + EPSG_CODE_METHOD_EQUIDISTANT_CYLINDRICAL_SPHERICAL) || + (otherMethodEPSGCode == EPSG_CODE_METHOD_EQUIDISTANT_CYLINDRICAL && + methodEPSGCode == + EPSG_CODE_METHOD_EQUIDISTANT_CYLINDRICAL_SPHERICAL)) { + auto geodCRS = + dynamic_cast<const crs::GeodeticCRS *>(sourceCRS().get()); + auto otherGeodCRS = dynamic_cast<const crs::GeodeticCRS *>( + otherSO->sourceCRS().get()); + if (geodCRS && otherGeodCRS && geodCRS->ellipsoid()->isSphere() && + otherGeodCRS->ellipsoid()->isSphere()) { + equivalentMethods = true; + } + } + } if (!equivalentMethods) { if (criterion == util::IComparable::Criterion::EQUIVALENT) { @@ -6500,8 +6500,7 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS( } } else if (step.name == "aeqd" && hasParamValue(step, "guam")) { mapping = getMapping(EPSG_CODE_METHOD_GUAM_PROJECTION); - } else if (step.name == "cea" && - !geogCRS->datum()->ellipsoid()->isSphere()) { + } else if (step.name == "cea" && !geogCRS->ellipsoid()->isSphere()) { mapping = getMapping(EPSG_CODE_METHOD_LAMBERT_CYLINDRICAL_EQUAL_AREA); } else if (step.name == "geos" && getParamValue(step, "sweep") == "x") { mapping = @@ -6598,6 +6597,15 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS( axisType = AxisType::SOUTH_POLE; } } + if (geogCRS->ellipsoid()->isSphere()) { + mapping = getMapping( + EPSG_CODE_METHOD_LAMBERT_AZIMUTHAL_EQUAL_AREA_SPHERICAL); + } + } else if (step.name == "eqc") { + if (geogCRS->ellipsoid()->isSphere()) { + mapping = + getMapping(EPSG_CODE_METHOD_EQUIDISTANT_CYLINDRICAL_SPHERICAL); + } } UnitOfMeasure unit = buildUnit(step, "units", "to_meter"); |
