From 82695cce869e1bcf2eb2a8ff078b679b6a21c663 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 8 Oct 2020 17:08:27 +0200 Subject: When reading from database, possibly return Geographic/GeodeticCRS with a DatumEnsemble, typically for WGS 84 and ETRS89 ('breaking change') --- include/proj/io.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/proj/io.hpp b/include/proj/io.hpp index 20dcedfe..35e924ec 100644 --- a/include/proj/io.hpp +++ b/include/proj/io.hpp @@ -1225,6 +1225,12 @@ class PROJ_GCC_DLL AuthorityFactory { private: PROJ_OPAQUE_PRIVATE_DATA + + PROJ_INTERNAL void + createGeodeticDatumOrEnsemble(const std::string &code, + datum::GeodeticReferenceFramePtr &outDatum, + datum::DatumEnsemblePtr &outDatumEnsemble, + bool turnEnsembleAsDatum) const; }; // --------------------------------------------------------------------------- -- cgit v1.2.3 From c2b0dcc468b4e722e46fe10fca93fe70a95fcb8e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 8 Oct 2020 18:41:57 +0200 Subject: When reading from database, possibly return VerticalCRS with a DatumEnsemble Only occurence for now is EPSG:9451 'BI height' using the 'British Isles height ensemble' --- include/proj/io.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/proj/io.hpp b/include/proj/io.hpp index 35e924ec..a30b04dc 100644 --- a/include/proj/io.hpp +++ b/include/proj/io.hpp @@ -1231,6 +1231,12 @@ class PROJ_GCC_DLL AuthorityFactory { datum::GeodeticReferenceFramePtr &outDatum, datum::DatumEnsemblePtr &outDatumEnsemble, bool turnEnsembleAsDatum) const; + + PROJ_INTERNAL void + createVerticalDatumOrEnsemble(const std::string &code, + datum::VerticalReferenceFramePtr &outDatum, + datum::DatumEnsemblePtr &outDatumEnsemble, + bool turnEnsembleAsDatum) const; }; // --------------------------------------------------------------------------- -- cgit v1.2.3 From 1e5acb00a0c0fc2533b9bce2e5803da10ed1d8d6 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 8 Oct 2020 20:59:19 +0200 Subject: projinfo / createObjectsFromName(): support returning a datum ensemble --- include/proj/io.hpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/proj/io.hpp b/include/proj/io.hpp index a30b04dc..de8a90fc 100644 --- a/include/proj/io.hpp +++ b/include/proj/io.hpp @@ -1032,6 +1032,8 @@ class PROJ_GCC_DLL AuthorityFactory { DYNAMIC_GEODETIC_REFERENCE_FRAME, /** Object of type datum::DynamicVerticalReferenceFrame */ DYNAMIC_VERTICAL_REFERENCE_FRAME, + /** Object of type datum::DatumEnsemble */ + DATUM_ENSEMBLE, }; PROJ_DLL std::set -- cgit v1.2.3 From 848ee7b6a8bf56a9d967f104ba2ef2ad92dc48d5 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 4 Nov 2020 15:24:44 +0100 Subject: createBoundCRSToWGS84IfPossible(): make it return same result with a CRS built from EPSG code or WKT1 Related to https://github.com/OSGeo/gdal/issues/3144 --- include/proj/crs.hpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/proj/crs.hpp b/include/proj/crs.hpp index b607ff9d..ec755728 100644 --- a/include/proj/crs.hpp +++ b/include/proj/crs.hpp @@ -155,6 +155,11 @@ class PROJ_GCC_DLL CRS : public common::ObjectUsage, const; PROJ_INTERNAL bool hasImplicitCS() const; + + PROJ_INTERNAL static CRSNNPtr + getResolvedCRS(const CRSNNPtr &crs, + const io::AuthorityFactoryPtr &authFactory, + metadata::ExtentPtr &extentOut); //! @endcond protected: -- cgit v1.2.3 From 3dea81d9be4712aa90ba79f333338c0b3ecb21e2 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 21 Nov 2020 13:55:11 +0100 Subject: Make GeographicCRS/GeodeticCRS::isEquivalentTo() work properly when comparing to a DerivedGeographicCRS/DerivedGeodeticCRS --- include/proj/crs.hpp | 5 +++++ include/proj/util.hpp | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'include') diff --git a/include/proj/crs.hpp b/include/proj/crs.hpp index ec755728..b921f4bb 100644 --- a/include/proj/crs.hpp +++ b/include/proj/crs.hpp @@ -340,6 +340,11 @@ class PROJ_GCC_DLL GeodeticCRS : virtual public SingleCRS, PROJ_INTERNAL std::list> _identify(const io::AuthorityFactoryPtr &authorityFactory) const override; + PROJ_INTERNAL bool + _isEquivalentToNoTypeCheck(const util::IComparable *other, + util::IComparable::Criterion criterion, + const io::DatabaseContextPtr &dbContext) const; + INLINED_MAKE_SHARED private: diff --git a/include/proj/util.hpp b/include/proj/util.hpp index 3d85e579..2ada4f79 100644 --- a/include/proj/util.hpp +++ b/include/proj/util.hpp @@ -213,6 +213,14 @@ template using nn_shared_ptr = nn>; // To avoid formatting differences between clang-format 3.8 and 7 #define PROJ_NOEXCEPT noexcept +//! @cond Doxygen_Suppress +// isOfExactType(*p) checks that the type of *p is exactly MyType +template +inline bool isOfExactType(const ObjectT &o) { + return typeid(TemplateT).hash_code() == typeid(o).hash_code(); +} +//! @endcond + /** \brief Loose transposition of [std::optional] * (https://en.cppreference.com/w/cpp/utility/optional) available from C++17. */ template class optional { -- cgit v1.2.3 From d8fe9964bcbc6d1eeaddf6f5d47ca6d444dc8744 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 22 Nov 2020 15:08:41 +0100 Subject: Add +proj=topocentric geocentric->topocentric conversion (fixes #500) --- .../internal/coordinateoperation_constants.hpp | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'include') diff --git a/include/proj/internal/coordinateoperation_constants.hpp b/include/proj/internal/coordinateoperation_constants.hpp index 592f6263..0ed3a027 100644 --- a/include/proj/internal/coordinateoperation_constants.hpp +++ b/include/proj/internal/coordinateoperation_constants.hpp @@ -532,6 +532,34 @@ static const ParamMapping *const paramsColombiaUrban[] = { ¶mProjectionPlaneOriginHeight, nullptr}; +static const ParamMapping paramGeocentricXTopocentricOrigin = { + EPSG_NAME_PARAMETER_GEOCENTRIC_X_TOPOCENTRIC_ORIGIN, + EPSG_CODE_PARAMETER_GEOCENTRIC_X_TOPOCENTRIC_ORIGIN, nullptr, + common::UnitOfMeasure::Type::LINEAR, "X_0"}; + +static const ParamMapping paramGeocentricYTopocentricOrigin = { + EPSG_NAME_PARAMETER_GEOCENTRIC_Y_TOPOCENTRIC_ORIGIN, + EPSG_CODE_PARAMETER_GEOCENTRIC_Y_TOPOCENTRIC_ORIGIN, nullptr, + common::UnitOfMeasure::Type::LINEAR, "Y_0"}; + +static const ParamMapping paramGeocentricZTopocentricOrigin = { + EPSG_NAME_PARAMETER_GEOCENTRIC_Z_TOPOCENTRIC_ORIGIN, + EPSG_CODE_PARAMETER_GEOCENTRIC_Z_TOPOCENTRIC_ORIGIN, nullptr, + common::UnitOfMeasure::Type::LINEAR, "Z_0"}; + +static const ParamMapping *const paramsGeocentricTopocentric[] = { + ¶mGeocentricXTopocentricOrigin, ¶mGeocentricYTopocentricOrigin, + ¶mGeocentricZTopocentricOrigin, nullptr}; + +static const ParamMapping paramHeightTopoOriginWithH0 = { + EPSG_NAME_PARAMETER_ELLIPSOIDAL_HEIGHT_TOPOCENTRIC_ORIGIN, + EPSG_CODE_PARAMETER_ELLIPSOIDAL_HEIGHT_TOPOCENTRIC_ORIGIN, nullptr, + common::UnitOfMeasure::Type::LINEAR, "h_0"}; + +static const ParamMapping *const paramsGeographicTopocentric[] = { + ¶mLatTopoOrigin, ¶mLonTopoOrigin, ¶mHeightTopoOriginWithH0, + nullptr}; + static const MethodMapping projectionMethodMappings[] = { {EPSG_NAME_METHOD_TRANSVERSE_MERCATOR, EPSG_CODE_METHOD_TRANSVERSE_MERCATOR, "Transverse_Mercator", "tmerc", nullptr, paramsNatOriginScaleK}, @@ -836,6 +864,14 @@ static const MethodMapping projectionMethodMappings[] = { {EPSG_NAME_METHOD_COLOMBIA_URBAN, EPSG_CODE_METHOD_COLOMBIA_URBAN, nullptr, "col_urban", nullptr, paramsColombiaUrban}, + + {EPSG_NAME_METHOD_GEOCENTRIC_TOPOCENTRIC, + EPSG_CODE_METHOD_GEOCENTRIC_TOPOCENTRIC, nullptr, "topocentric", nullptr, + paramsGeocentricTopocentric}, + + {EPSG_NAME_METHOD_GEOGRAPHIC_TOPOCENTRIC, + EPSG_CODE_METHOD_GEOGRAPHIC_TOPOCENTRIC, nullptr, nullptr, nullptr, + paramsGeographicTopocentric}, }; #define METHOD_NAME_CODE(method) \ @@ -878,6 +914,8 @@ static const struct MethodNameCode { METHOD_NAME_CODE(AXIS_ORDER_REVERSAL_2D), METHOD_NAME_CODE(AXIS_ORDER_REVERSAL_3D), METHOD_NAME_CODE(GEOGRAPHIC_GEOCENTRIC), + METHOD_NAME_CODE(GEOCENTRIC_TOPOCENTRIC), + METHOD_NAME_CODE(GEOGRAPHIC_TOPOCENTRIC), // Transformations METHOD_NAME_CODE(LONGITUDE_ROTATION), METHOD_NAME_CODE(AFFINE_PARAMETRIC_TRANSFORMATION), @@ -943,6 +981,9 @@ static const struct ParamNameCode { PARAM_NAME_CODE(LONGITUDE_OF_ORIGIN), PARAM_NAME_CODE(ELLIPSOID_SCALE_FACTOR), PARAM_NAME_CODE(PROJECTION_PLANE_ORIGIN_HEIGHT), + PARAM_NAME_CODE(GEOCENTRIC_X_TOPOCENTRIC_ORIGIN), + PARAM_NAME_CODE(GEOCENTRIC_Y_TOPOCENTRIC_ORIGIN), + PARAM_NAME_CODE(GEOCENTRIC_Z_TOPOCENTRIC_ORIGIN), // Parameters of transformations PARAM_NAME_CODE(SEMI_MAJOR_AXIS_DIFFERENCE), PARAM_NAME_CODE(FLATTENING_DIFFERENCE), -- cgit v1.2.3 From 4caf32aedd4da6b1fd1b1ce0e04a1a08dc1e3f33 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 24 Nov 2020 19:16:12 +0100 Subject: Add option to allow export of Geographic/Projected 3D CRS in WKT1_GDAL as CompoundCRS with a VerticalCRS being an ellipsoidal height, which is not conformant. But needed for LAS 1.4 that only supports WKT1 --- include/proj/io.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/proj/io.hpp b/include/proj/io.hpp index de8a90fc..bc11c220 100644 --- a/include/proj/io.hpp +++ b/include/proj/io.hpp @@ -243,6 +243,10 @@ class PROJ_GCC_DLL WKTFormatter { PROJ_DLL WKTFormatter &setStrict(bool strict) noexcept; PROJ_DLL bool isStrict() const noexcept; + PROJ_DLL WKTFormatter & + setAllowEllipsoidalHeightAsVerticalCRS(bool allow) noexcept; + PROJ_DLL bool isAllowedEllipsoidalHeightAsVerticalCRS() const noexcept; + PROJ_DLL const std::string &toString() const; PROJ_PRIVATE : -- cgit v1.2.3 From 59b112687a9ae26425c300738a14d73ae4090476 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 27 Nov 2020 21:27:31 +0100 Subject: crs.hpp: add cppcheck suppression for cppcheck 1.90 of ubuntu 20.04 --- include/proj/crs.hpp | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/proj/crs.hpp b/include/proj/crs.hpp index b921f4bb..8c1f9f6f 100644 --- a/include/proj/crs.hpp +++ b/include/proj/crs.hpp @@ -1410,6 +1410,7 @@ class PROJ_GCC_DLL DerivedCRSTemplate final : public DerivedCRSTraits::BaseType, DerivedCRSTemplate(const BaseNNPtr &baseCRSIn, const operation::ConversionNNPtr &derivingConversionIn, const CSNNPtr &csIn); + // cppcheck-suppress noExplicitConstructor PROJ_INTERNAL DerivedCRSTemplate(const DerivedCRSTemplate &other); PROJ_INTERNAL CRSNNPtr _shallowClone() const override; -- cgit v1.2.3