From 5527b10ed140e20fac8e183317514fd59e4c8b99 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 7 Sep 2021 19:57:36 +0200 Subject: Support importing/exporting WKT & PROJJSON of 2D axis spherical planetocentric geodetic CRS --- include/proj/coordinatesystem.hpp | 5 +++++ include/proj/crs.hpp | 2 ++ 2 files changed, 7 insertions(+) (limited to 'include') diff --git a/include/proj/coordinatesystem.hpp b/include/proj/coordinatesystem.hpp index e1650168..b40b038d 100644 --- a/include/proj/coordinatesystem.hpp +++ b/include/proj/coordinatesystem.hpp @@ -314,6 +314,11 @@ class PROJ_GCC_DLL SphericalCS final : public CoordinateSystem { const CoordinateSystemAxisNNPtr &axis2, const CoordinateSystemAxisNNPtr &axis3); + PROJ_DLL static SphericalCSNNPtr + create(const util::PropertyMap &properties, + const CoordinateSystemAxisNNPtr &axis1, + const CoordinateSystemAxisNNPtr &axis2); + protected: PROJ_INTERNAL explicit SphericalCS( const std::vector &axisIn); diff --git a/include/proj/crs.hpp b/include/proj/crs.hpp index dcab094a..7fde88c8 100644 --- a/include/proj/crs.hpp +++ b/include/proj/crs.hpp @@ -270,6 +270,8 @@ class PROJ_GCC_DLL GeodeticCRS : virtual public SingleCRS, PROJ_DLL bool isGeocentric() PROJ_PURE_DECL; + PROJ_DLL bool isSphericalPlanetocentric() PROJ_PURE_DECL; + PROJ_DLL static GeodeticCRSNNPtr create(const util::PropertyMap &properties, const datum::GeodeticReferenceFrameNNPtr &datum, -- cgit v1.2.3 From 85733181ee7c2777139f5d1db94f2beabb737e96 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 8 Sep 2021 12:50:37 +0200 Subject: createOperations(): deal with spherical planetocentric geodetic CRS This also fixes conversion between geocentric latlong and geodetic latlong with cs2cs. This was dealt with in PR 1093, but in the wrong direction (the geocentric latitude must be <= in absolute value to the geodetic one) The issue here was linked to the semantics of the +geoc specifier, which affects the semantics of the input coordinates in the forward direction (+geoc means that the input coordinate is is a geocentric latitude), which defeats the logic of doing A to B by using the inverse path of A and the forward path of B. --- include/proj/crs.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/proj/crs.hpp b/include/proj/crs.hpp index 7fde88c8..5a8e75ae 100644 --- a/include/proj/crs.hpp +++ b/include/proj/crs.hpp @@ -310,6 +310,9 @@ class PROJ_GCC_DLL GeodeticCRS : virtual public SingleCRS, PROJ_INTERNAL void addGeocentricUnitConversionIntoPROJString( io::PROJStringFormatter *formatter) const; + PROJ_INTERNAL void + addAngularUnitConvertAndAxisSwap(io::PROJStringFormatter *formatter) const; + PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) const override; // throw(io::FormattingException) @@ -402,12 +405,10 @@ class PROJ_GCC_DLL GeographicCRS : public GeodeticCRS { PROJ_PRIVATE : //! @cond Doxygen_Suppress - PROJ_INTERNAL void - addAngularUnitConvertAndAxisSwap( - io::PROJStringFormatter *formatter) const; - PROJ_INTERNAL void _exportToPROJString(io::PROJStringFormatter *formatter) - const override; // throw(FormattingException) + PROJ_INTERNAL void + _exportToPROJString(io::PROJStringFormatter *formatter) + const override; // throw(FormattingException) PROJ_INTERNAL void _exportToJSON(io::JSONFormatter *formatter) const override; // throw(FormattingException) -- cgit v1.2.3 From 078952e7f078e029d66ab6ca1ed594dfecadd1fc Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 8 Sep 2021 14:34:50 +0200 Subject: createOperations(): use an explicit conversion operation for geodetic <--> geocentric latitude --- include/proj/coordinateoperation.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/proj/coordinateoperation.hpp b/include/proj/coordinateoperation.hpp index 3d2ab800..fc1d5b8a 100644 --- a/include/proj/coordinateoperation.hpp +++ b/include/proj/coordinateoperation.hpp @@ -1385,6 +1385,10 @@ class PROJ_GCC_DLL Conversion : public SingleOperation { createGeographicGeocentric(const crs::CRSNNPtr &sourceCRS, const crs::CRSNNPtr &targetCRS); + PROJ_INTERNAL static ConversionNNPtr + createGeographicGeocentricLatitude(const crs::CRSNNPtr &sourceCRS, + const crs::CRSNNPtr &targetCRS); + //! @endcond protected: -- cgit v1.2.3