From fdf5111a9a790926aacec75a07d30508a8ed9c91 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 16 Mar 2022 00:15:16 +0100 Subject: Fix comparison of GeodeticRefrenceFrame vs DynamicGeodeticReferenceFrame If comparing a DynamicGeodeticReferenceFrame object and its export to WKT1, which is a simple DATUM object, currently in non-strict comparison mode, we'd consider the datum to be equivalent to the dynamic datum, but not the reverse, which breaks the symmetric property of the isEquivalentTo() operation. So fix this, to consider both equivalent whatever the operand order. (in strict mode, the objects will be considered different of course) Spotted in the GDAL GeoTIFF CRS reader code: https://github.com/OSGeo/gdal/blob/f9d48bdcc8c90df20e53b5af5785f1e5d78910db/frmts/gtiff/gt_wkt_srs.cpp#L832 Do same change for vertical datum vs dynamic vertical datum. --- include/proj/datum.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/proj/datum.hpp b/include/proj/datum.hpp index bf3dbcb7..ad388908 100644 --- a/include/proj/datum.hpp +++ b/include/proj/datum.hpp @@ -432,6 +432,10 @@ class PROJ_GCC_DLL GeodeticReferenceFrame : public Datum { util::IComparable::Criterion criterion = util::IComparable::Criterion::STRICT, const io::DatabaseContextPtr &dbContext = nullptr) const override; + + PROJ_INTERNAL bool isEquivalentToNoExactTypeCheck( + const util::IComparable *other, util::IComparable::Criterion criterion, + const io::DatabaseContextPtr &dbContext) const; //! @endcond protected: @@ -587,6 +591,10 @@ class PROJ_GCC_DLL VerticalReferenceFrame : public Datum { util::IComparable::Criterion::STRICT, const io::DatabaseContextPtr &dbContext = nullptr) const override; + PROJ_INTERNAL bool isEquivalentToNoExactTypeCheck( + const util::IComparable *other, util::IComparable::Criterion criterion, + const io::DatabaseContextPtr &dbContext) const; + PROJ_INTERNAL void _exportToWKT(io::WKTFormatter *formatter) const override; // throw(io::FormattingException) -- cgit v1.2.3