diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-03-25 10:41:29 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-03-25 15:15:29 +0100 |
| commit | fbc654ab0c3dc6d707bdee226121275736c2bfb5 (patch) | |
| tree | 47b8ee6d2c0656b7187206f7599943f17b305f4a /src | |
| parent | 23d2941ef30f5fa62230606766ae8b9e296f814f (diff) | |
| download | PROJ-fbc654ab0c3dc6d707bdee226121275736c2bfb5.tar.gz PROJ-fbc654ab0c3dc6d707bdee226121275736c2bfb5.zip | |
EngineeringCRS: when exporting to WKT1_GDAL, output unit and axis (fixes https://github.com/OSGeo/gdal/issues/2347)
Diffstat (limited to 'src')
| -rw-r--r-- | src/iso19111/crs.cpp | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp index 66d7a62e..cff93508 100644 --- a/src/iso19111/crs.cpp +++ b/src/iso19111/crs.cpp @@ -310,17 +310,15 @@ CRSNNPtr CRS::alterCSLinearUnit(const common::UnitOfMeasure &unit) const { auto cartCS = util::nn_dynamic_pointer_cast<cs::CartesianCS>( engCRS->coordinateSystem()); if (cartCS) { - auto props = createPropertyMap(this); - props.set("FORCE_OUTPUT_CS", true); - return EngineeringCRS::create(props, engCRS->datum(), + return EngineeringCRS::create(createPropertyMap(this), + engCRS->datum(), cartCS->alterUnit(unit)); } else { auto vertCS = util::nn_dynamic_pointer_cast<cs::VerticalCS>( engCRS->coordinateSystem()); if (vertCS) { - auto props = createPropertyMap(this); - props.set("FORCE_OUTPUT_CS", true); - return EngineeringCRS::create(props, engCRS->datum(), + return EngineeringCRS::create(createPropertyMap(this), + engCRS->datum(), vertCS->alterUnit(unit)); } } @@ -5433,9 +5431,7 @@ bool TemporalCRS::_isEquivalentTo( // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress -struct EngineeringCRS::Private { - bool forceOutputCS_ = false; -}; +struct EngineeringCRS::Private {}; //! @endcond // --------------------------------------------------------------------------- @@ -5493,17 +5489,6 @@ EngineeringCRS::create(const util::PropertyMap &properties, crs->assignSelf(crs); crs->setProperties(properties); - const auto pVal = properties.get("FORCE_OUTPUT_CS"); - if (pVal) { - if (const auto genVal = - dynamic_cast<const util::BoxedValue *>(pVal->get())) { - if (genVal->type() == util::BoxedValue::Type::BOOLEAN && - genVal->booleanValue()) { - crs->d->forceOutputCS_ = true; - } - } - } - return crs; } @@ -5518,11 +5503,16 @@ void EngineeringCRS::_exportToWKT(io::WKTFormatter *formatter) const { formatter->addQuotedString(nameStr()); if (isWKT2 || !datum()->nameStr().empty()) { datum()->_exportToWKT(formatter); - coordinateSystem()->_exportToWKT(formatter); } - if (!isWKT2 && d->forceOutputCS_) { + if (!isWKT2) { coordinateSystem()->axisList()[0]->unit()._exportToWKT(formatter); } + + const auto oldAxisOutputRule = formatter->outputAxis(); + formatter->setOutputAxis(io::WKTFormatter::OutputAxisRule::YES); + coordinateSystem()->_exportToWKT(formatter); + formatter->setOutputAxis(oldAxisOutputRule); + ObjectUsage::baseExportToWKT(formatter); formatter->endNode(); } |
