diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-09-04 15:46:13 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-09-08 11:11:03 +0200 |
| commit | 024f63731283c0026ad5b4dea4084bc48bbcc6f7 (patch) | |
| tree | 7264a3e7c9f5388a537d0d4dbb31bbeceea720b0 /src/iso19111/crs.cpp | |
| parent | faf7ec2d7f5d489bfd187f1a3408f0f09f94282f (diff) | |
| download | PROJ-024f63731283c0026ad5b4dea4084bc48bbcc6f7.tar.gz PROJ-024f63731283c0026ad5b4dea4084bc48bbcc6f7.zip | |
Use in API and utilities WKT2_2019 instead of WKT2_2018 (fixes #1518)
- C API: PJ_GUESSED_WKT2_2019 is added, PJ_GUESSED_WKT2_2018 aliased to it
- C API: PJ_WKT2_2019[_SIMPLIFIED] is added, PJ_WKT2_2018[_SIMPLIFIED] alias to it
- C++ API: similarly for WKTFormatter::Convention::WKT2_2019[_SIMPLIFIED]
Those above changes should be fully backward API and ABI compatible.
projinfo changes:
- accept WKT2_2019 as value for -o switch. WKT2_2018 is still accepted (undocumented)
- output now uses 'WKT2_2019 string:', so might break scripts that would rely on that.
Other internal code references to WKT2_2018 changes to WKT2_2019, included
in tests.
Diffstat (limited to 'src/iso19111/crs.cpp')
| -rw-r--r-- | src/iso19111/crs.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp index 60b316f1..07f4eb69 100644 --- a/src/iso19111/crs.cpp +++ b/src/iso19111/crs.cpp @@ -1148,7 +1148,7 @@ void GeodeticCRS::_exportToWKT(io::WKTFormatter *formatter) const { const bool isGeographic = dynamic_cast<const GeographicCRS *>(this) != nullptr; formatter->startNode(isWKT2 - ? ((formatter->use2018Keywords() && isGeographic) + ? ((formatter->use2019Keywords() && isGeographic) ? io::WKTConstants::GEOGCRS : io::WKTConstants::GEODCRS) : isGeocentric() ? io::WKTConstants::GEOCCS @@ -2698,11 +2698,11 @@ void DerivedCRS::baseExportToWKT(io::WKTFormatter *formatter, formatter->addQuotedString(nameStr()); const auto &l_baseCRS = d->baseCRS_; - formatter->startNode(baseKeyword, formatter->use2018Keywords() && + formatter->startNode(baseKeyword, formatter->use2019Keywords() && !l_baseCRS->identifiers().empty()); formatter->addQuotedString(l_baseCRS->nameStr()); l_baseCRS->exportDatumOrDatumEnsembleToWkt(formatter); - if (formatter->use2018Keywords() && + if (formatter->use2019Keywords() && !(formatter->idOnTopLevelOnly() && formatter->topLevelHasId())) { l_baseCRS->formatID(formatter); } @@ -2883,9 +2883,9 @@ void ProjectedCRS::_exportToWKT(io::WKTFormatter *formatter) const { const auto &l_coordinateSystem = d->coordinateSystem(); const auto &axisList = l_coordinateSystem->axisList(); - if (axisList.size() == 3 && !(isWKT2 && formatter->use2018Keywords())) { + if (axisList.size() == 3 && !(isWKT2 && formatter->use2019Keywords())) { io::FormattingException::Throw( - "Projected 3D CRS can only be exported since WKT2:2018"); + "Projected 3D CRS can only be exported since WKT2:2019"); } const auto exportAxis = [&l_coordinateSystem, &axisList, &formatter]() { @@ -2962,11 +2962,11 @@ void ProjectedCRS::_exportToWKT(io::WKTFormatter *formatter) const { if (isWKT2) { formatter->startNode( - (formatter->use2018Keywords() && + (formatter->use2019Keywords() && dynamic_cast<const GeographicCRS *>(l_baseCRS.get())) ? io::WKTConstants::BASEGEOGCRS : io::WKTConstants::BASEGEODCRS, - formatter->use2018Keywords() && !l_baseCRS->identifiers().empty()); + formatter->use2019Keywords() && !l_baseCRS->identifiers().empty()); formatter->addQuotedString(l_baseCRS->nameStr()); l_baseCRS->exportDatumOrDatumEnsembleToWkt(formatter); // insert ellipsoidal cs unit when the units of the map @@ -2977,7 +2977,7 @@ void ProjectedCRS::_exportToWKT(io::WKTFormatter *formatter) const { geodeticCRSAxisList[0]->unit()._exportToWKT(formatter); } l_baseCRS->primeMeridian()->_exportToWKT(formatter); - if (formatter->use2018Keywords() && + if (formatter->use2019Keywords() && !(formatter->idOnTopLevelOnly() && formatter->topLevelHasId())) { l_baseCRS->formatID(formatter); } @@ -4422,7 +4422,7 @@ void DerivedGeodeticCRS::_exportToWKT(io::WKTFormatter *formatter) const { formatter->addQuotedString(nameStr()); auto l_baseCRS = baseCRS(); - formatter->startNode((formatter->use2018Keywords() && + formatter->startNode((formatter->use2019Keywords() && dynamic_cast<const GeographicCRS *>(l_baseCRS.get())) ? io::WKTConstants::BASEGEOGCRS : io::WKTConstants::BASEGEODCRS, @@ -4560,14 +4560,14 @@ void DerivedGeographicCRS::_exportToWKT(io::WKTFormatter *formatter) const { io::FormattingException::Throw( "DerivedGeographicCRS can only be exported to WKT2"); } - formatter->startNode(formatter->use2018Keywords() + formatter->startNode(formatter->use2019Keywords() ? io::WKTConstants::GEOGCRS : io::WKTConstants::GEODCRS, !identifiers().empty()); formatter->addQuotedString(nameStr()); auto l_baseCRS = baseCRS(); - formatter->startNode((formatter->use2018Keywords() && + formatter->startNode((formatter->use2019Keywords() && dynamic_cast<const GeographicCRS *>(l_baseCRS.get())) ? io::WKTConstants::BASEGEOGCRS : io::WKTConstants::BASEGEODCRS, @@ -4693,9 +4693,9 @@ DerivedProjectedCRSNNPtr DerivedProjectedCRS::create( //! @cond Doxygen_Suppress void DerivedProjectedCRS::_exportToWKT(io::WKTFormatter *formatter) const { const bool isWKT2 = formatter->version() == io::WKTFormatter::Version::WKT2; - if (!isWKT2 || !formatter->use2018Keywords()) { + if (!isWKT2 || !formatter->use2019Keywords()) { io::FormattingException::Throw( - "DerivedProjectedCRS can only be exported to WKT2:2018"); + "DerivedProjectedCRS can only be exported to WKT2:2019"); } formatter->startNode(io::WKTConstants::DERIVEDPROJCRS, !identifiers().empty()); @@ -5348,12 +5348,12 @@ const char *DerivedCRSTemplate<DerivedCRSTraits>::className() const { static void DerivedCRSTemplateCheckExportToWKT(io::WKTFormatter *formatter, const std::string &crsName, - bool wkt2_2018_only) { + bool wkt2_2019_only) { const bool isWKT2 = formatter->version() == io::WKTFormatter::Version::WKT2; - if (!isWKT2 || (wkt2_2018_only && !formatter->use2018Keywords())) { + if (!isWKT2 || (wkt2_2019_only && !formatter->use2019Keywords())) { io::FormattingException::Throw(crsName + " can only be exported to WKT2" + - (wkt2_2018_only ? ":2018" : "")); + (wkt2_2019_only ? ":2019" : "")); } } @@ -5363,7 +5363,7 @@ template <class DerivedCRSTraits> void DerivedCRSTemplate<DerivedCRSTraits>::_exportToWKT( io::WKTFormatter *formatter) const { DerivedCRSTemplateCheckExportToWKT(formatter, DerivedCRSTraits::CRSName(), - DerivedCRSTraits::wkt2_2018_only); + DerivedCRSTraits::wkt2_2019_only); baseExportToWKT(formatter, DerivedCRSTraits::WKTKeyword(), DerivedCRSTraits::WKTBaseKeyword()); } |
