diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2022-02-14 20:40:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-14 20:40:25 +0100 |
| commit | d4deb549982a16c0b7b324739af781d2779f2324 (patch) | |
| tree | 0ac30dd48e217392fcf1b3937e025adaa81b9730 /src/iso19111/crs.cpp | |
| parent | f67c82912fde55a58d565697263306c840b3efd4 (diff) | |
| parent | df9e2fe519d97139a8264057d96b034788e8e8e7 (diff) | |
| download | PROJ-d4deb549982a16c0b7b324739af781d2779f2324.tar.gz PROJ-d4deb549982a16c0b7b324739af781d2779f2324.zip | |
Merge pull request #3055 from rouault/over_fix
Better deal with importing strings like '+init=epsg:XXXX +over' (refs MapServer/MapServer#6478)
Diffstat (limited to 'src/iso19111/crs.cpp')
| -rw-r--r-- | src/iso19111/crs.cpp | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp index 2ea8393c..4750896a 100644 --- a/src/iso19111/crs.cpp +++ b/src/iso19111/crs.cpp @@ -98,20 +98,36 @@ struct CRS::Private { BoundCRSPtr canonicalBoundCRS_{}; std::string extensionProj4_{}; bool implicitCS_ = false; + bool over_ = false; bool allowNonConformantWKT1Export_ = false; // for what was initially a COMPD_CS with a VERT_CS with a datum type == // ellipsoidal height / 2002 CompoundCRSPtr originalCompoundCRS_{}; - void setImplicitCS(const util::PropertyMap &properties) { - const auto pVal = properties.get("IMPLICIT_CS"); - if (pVal) { - if (const auto genVal = - dynamic_cast<const util::BoxedValue *>(pVal->get())) { - if (genVal->type() == util::BoxedValue::Type::BOOLEAN && - genVal->booleanValue()) { - implicitCS_ = true; + void setNonStandardProperties(const util::PropertyMap &properties) { + { + const auto pVal = properties.get("IMPLICIT_CS"); + if (pVal) { + if (const auto genVal = + dynamic_cast<const util::BoxedValue *>(pVal->get())) { + if (genVal->type() == util::BoxedValue::Type::BOOLEAN && + genVal->booleanValue()) { + implicitCS_ = true; + } + } + } + } + + { + const auto pVal = properties.get("OVER"); + if (pVal) { + if (const auto genVal = + dynamic_cast<const util::BoxedValue *>(pVal->get())) { + if (genVal->type() == util::BoxedValue::Type::BOOLEAN && + genVal->booleanValue()) { + over_ = true; + } } } } @@ -142,6 +158,9 @@ CRS::~CRS() = default; * (e.g from ESRI WKT) */ bool CRS::hasImplicitCS() const { return d->implicitCS_; } +/** \brief Return whether the CRS has a +over flag */ +bool CRS::hasOver() const { return d->over_; } + //! @endcond // --------------------------------------------------------------------------- @@ -2854,7 +2873,7 @@ GeographicCRS::create(const util::PropertyMap &properties, GeographicCRS::nn_make_shared<GeographicCRS>(datum, datumEnsemble, cs)); crs->assignSelf(crs); crs->setProperties(properties); - crs->CRS::getPrivate()->setImplicitCS(properties); + crs->CRS::getPrivate()->setNonStandardProperties(properties); return crs; } @@ -3122,6 +3141,9 @@ void GeographicCRS::_exportToPROJString( if (!formatter->getCRSExport()) { addAngularUnitConvertAndAxisSwap(formatter); } + if (hasOver()) { + formatter->addParam("over"); + } } //! @endcond @@ -4298,7 +4320,7 @@ ProjectedCRS::create(const util::PropertyMap &properties, crs->assignSelf(crs); crs->setProperties(properties); crs->setDerivingConversionCRS(); - crs->CRS::getPrivate()->setImplicitCS(properties); + crs->CRS::getPrivate()->setNonStandardProperties(properties); return crs; } |
