diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-03-25 17:55:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-25 17:55:24 +0100 |
| commit | edce2ae69b989b6124d57ae8b06d81ca56add8cf (patch) | |
| tree | 7fcc065846bc53a3fcf0e0976f9ae7281f392106 /src | |
| parent | f1d7b64e8bec7af77e453353dbb6bf6f61986bd6 (diff) | |
| parent | c9ba095e0494936d94542c69d38ab12ff23b1cb9 (diff) | |
| download | PROJ-edce2ae69b989b6124d57ae8b06d81ca56add8cf.tar.gz PROJ-edce2ae69b989b6124d57ae8b06d81ca56add8cf.zip | |
Merge pull request #2092 from PROJ-BOT/backport-2090-to-7.0
[Backport 7.0] 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 187d16d1..1077929d 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)); } } @@ -5416,9 +5414,7 @@ bool TemporalCRS::_isEquivalentTo( // --------------------------------------------------------------------------- //! @cond Doxygen_Suppress -struct EngineeringCRS::Private { - bool forceOutputCS_ = false; -}; +struct EngineeringCRS::Private {}; //! @endcond // --------------------------------------------------------------------------- @@ -5476,17 +5472,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; } @@ -5501,11 +5486,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(); } |
