From f5e5435fd5071d550e0d13f7a5d71e09c1fab2c0 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 8 Jan 2019 16:22:15 +0100 Subject: ISO19111: remove PROJ.5 specific format for CRS (refs #1214) As discussed in https://github.com/OSGeo/proj.4/issues/1214#issuecomment-452084720, the introduction of a new PROJ.5 format to export CRS using pipeline/unitconvert/axisswap as an attempt of improving the PROJ.4 format used by GDAL and other products is likely a dead-end since it is still lossy in many aspects and can cause confusion with coodinate operations. Consequently the PROJ_5 convention will be identical to PROJ_4 for CRS export. Note: on the import side, I've kept the code that could parse unitconvert and axisswap when building a CRS definition from a pipeline. It is there as a hidden feature as it was kind of a tear to remove that code in case it might still be useful... --- include/proj/crs.hpp | 31 +++++++++------------- .../internal/coordinateoperation_constants.hpp | 2 +- include/proj/internal/esri_projection_mappings.hpp | 2 +- include/proj/io.hpp | 29 ++++++++------------ 4 files changed, 26 insertions(+), 38 deletions(-) (limited to 'include') diff --git a/include/proj/crs.hpp b/include/proj/crs.hpp index cc9fdeb9..65414d7d 100644 --- a/include/proj/crs.hpp +++ b/include/proj/crs.hpp @@ -502,9 +502,6 @@ class PROJ_GCC_DLL DerivedCRS : virtual public SingleCRS { PROJ_INTERNAL void setDerivingConversionCRS(); - PROJ_INTERNAL void baseExportToPROJString( - io::PROJStringFormatter *formatter) const; // throw(FormattingException) - PROJ_INTERNAL void baseExportToWKT( io::WKTFormatter *&formatter, const std::string &keyword, const std::string &baseKeyword) const; // throw(FormattingException) @@ -977,9 +974,6 @@ class PROJ_GCC_DLL DerivedGeodeticCRS final : public GeodeticCRS, const cs::SphericalCSNNPtr &csIn); PROJ_INTERNAL DerivedGeodeticCRS(const DerivedGeodeticCRS &other); - PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) - const override; // throw(FormattingException) - PROJ_INTERNAL CRSNNPtr _shallowClone() const override; PROJ_INTERNAL bool @@ -990,6 +984,10 @@ class PROJ_GCC_DLL DerivedGeodeticCRS final : public GeodeticCRS, PROJ_INTERNAL std::list> _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; + // cppcheck-suppress functionStatic + PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) + const override; // throw(FormattingException) + INLINED_MAKE_SHARED private: @@ -1041,9 +1039,6 @@ class PROJ_GCC_DLL DerivedGeographicCRS final : public GeographicCRS, const cs::EllipsoidalCSNNPtr &csIn); PROJ_INTERNAL DerivedGeographicCRS(const DerivedGeographicCRS &other); - PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) - const override; // throw(FormattingException) - PROJ_INTERNAL CRSNNPtr _shallowClone() const override; PROJ_INTERNAL bool @@ -1054,6 +1049,10 @@ class PROJ_GCC_DLL DerivedGeographicCRS final : public GeographicCRS, PROJ_INTERNAL std::list> _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; + // cppcheck-suppress functionStatic + PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) + const override; // throw(FormattingException) + INLINED_MAKE_SHARED private: @@ -1078,9 +1077,7 @@ using DerivedProjectedCRSNNPtr = util::nn; * * \remark Implements DerivedProjectedCRS from \ref ISO_19111_2018 */ -class PROJ_GCC_DLL DerivedProjectedCRS final - : public DerivedCRS, - public io::IPROJStringExportable { +class PROJ_GCC_DLL DerivedProjectedCRS final : public DerivedCRS { public: //! @cond Doxygen_Suppress PROJ_DLL ~DerivedProjectedCRS() override; @@ -1106,9 +1103,6 @@ class PROJ_GCC_DLL DerivedProjectedCRS final const cs::CoordinateSystemNNPtr &csIn); PROJ_INTERNAL DerivedProjectedCRS(const DerivedProjectedCRS &other); - PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) - const override; // throw(FormattingException) - PROJ_INTERNAL CRSNNPtr _shallowClone() const override; PROJ_INTERNAL bool @@ -1164,9 +1158,6 @@ class PROJ_GCC_DLL DerivedVerticalCRS final : public VerticalCRS, const cs::VerticalCSNNPtr &csIn); PROJ_INTERNAL DerivedVerticalCRS(const DerivedVerticalCRS &other); - PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) - const override; // throw(FormattingException) - PROJ_INTERNAL CRSNNPtr _shallowClone() const override; PROJ_INTERNAL bool @@ -1177,6 +1168,10 @@ class PROJ_GCC_DLL DerivedVerticalCRS final : public VerticalCRS, PROJ_INTERNAL std::list> _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; + // cppcheck-suppress functionStatic + PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) + const override; // throw(FormattingException) + INLINED_MAKE_SHARED private: diff --git a/include/proj/internal/coordinateoperation_constants.hpp b/include/proj/internal/coordinateoperation_constants.hpp index 53a2622e..accb4a1e 100644 --- a/include/proj/internal/coordinateoperation_constants.hpp +++ b/include/proj/internal/coordinateoperation_constants.hpp @@ -1240,7 +1240,7 @@ static const MethodMapping otherMethodMappings[] = { }; // end of anonymous namespace -} +} // namespace // --------------------------------------------------------------------------- diff --git a/include/proj/internal/esri_projection_mappings.hpp b/include/proj/internal/esri_projection_mappings.hpp index 4ceeb300..423f28be 100644 --- a/include/proj/internal/esri_projection_mappings.hpp +++ b/include/proj/internal/esri_projection_mappings.hpp @@ -880,7 +880,7 @@ static const ESRIMethodMapping esriMappings[] = { // --------------------------------------------------------------------------- // end of anonymous namespace -} +} // namespace //! @endcond diff --git a/include/proj/io.hpp b/include/proj/io.hpp index 3d09e7d3..8d930c24 100644 --- a/include/proj/io.hpp +++ b/include/proj/io.hpp @@ -371,7 +371,9 @@ class PROJ_GCC_DLL PROJStringFormatter { //! @cond Doxygen_Suppress PROJ_DLL void - startInversion(); + setCRSExport(bool b); + PROJ_INTERNAL bool getCRSExport() const; + PROJ_DLL void startInversion(); PROJ_DLL void stopInversion(); PROJ_INTERNAL bool isInverted() const; PROJ_INTERNAL bool getUseETMercForTMerc(bool &settingSetOut) const; @@ -508,24 +510,15 @@ class PROJ_GCC_DLL IPROJStringExportable { /** \brief Builds a PROJ string representation. * *
    - *
  • For PROJStringFormatter::Convention::PROJ_5 (the default), return - * strings that generally express PROJ.5 pipelines. + *
  • For PROJStringFormatter::Convention::PROJ_5 (the default), *
      - *
    • For a crs::GeographicCRS, returns a string expressing the - * transformation from geographic coordinates expressed in radian with - * longitude, latitude order, and with respect to the international - * reference meridian, into geographic coordinates expressed in the units - * and axis order of the CRS, taking into account its prime meridian.
    • - *
    • For a geocentric crs::GeodeticCRS, returns a string expressing the - * transformation from geographic coordinates expressed in radian with - * longitude, latitude order, and with respect to the international - * reference meridian, into geocentric coordinates.
    • - *
    • For a - * crs::ProjectedCRS / crs::DerivedGeographicCRS / crs::DerivedProjectedCRS, - * returns a string expressing the transformation from the base CRS to the - * CRS
    • - *
    • For a crs::BoundCRS, throws a FormattingException.
    • - *
    • For operation::CoordinateTransformations, returns a PROJ + *
    • For a crs::CRS, returns the same as + * PROJStringFormatter::Convention::PROJ_4. It should be noted that the + * export of a CRS as a PROJ string may cause loss of many important aspects + * of a CRS definition. Consequently it is discouraged to use it for + * interoperability in newer projects. The choice of a WKT representation + * will be a better option.
    • + *
    • For operation::CoordinateOperation, returns a PROJ * pipeline.
    • *
    * -- cgit v1.2.3