[PROJ] Is Equivalent To Between Authority Codes and Proj Strings

Peter Townsend peter.townsend at maplarge.com
Wed Sep 29 14:01:59 PDT 2021


I was looking at using the proj_is_equivalent_to_with_ctx method, in
particular the "proj_is_equivalent_to_with_ctx" test method that uses
EPSG:7844. It pulls EPSG:7844 from the database, then loads it from the WKT
and shows that they're equivalent.

So then I tried against the exported proj string version, "+proj=longlat
+ellps=GRS80 +no_defs +type=crs". I threw that at the equivalent_to method
w/ both PJ_COMP_EQUIVALENT and
PJ_COMP_EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS, and they both came out false.
I dug down the rabbit hole and got down to
GeodeticReferenceFrame::hasEquivalentNameToUsingAlias. The reason it's
coming out false is because the datum names don't match. One is "GDA2020"
and the other is "Unknown based on GRS80 ellipsoid".

It makes sense since the proj string doesn't really give that kind of
detail. But is there any consistent way to perform an equivalency check
between two CRS's given an EPSG code and a proj string, or
is something amiss? (I did try proj_identify on that GRS80 string and 7844
doesn't even show up.)

This is with version 8.1. I tried a few others to see what happened with
them. 4326, 3857, 3031, 3995, 32631 worked. 23031, 29193 also had
mismatched datums. Not sure what the connection is between them that makes
it work.

Here's the full stack trace to the false:
>
libproj_d.dll!osgeo::proj::datum::GeodeticReferenceFrame::hasEquivalentNameToUsingAlias(const
osgeo::proj::common::IdentifiedObject * other, const
std::shared_ptr<osgeo::proj::io::DatabaseContext> & dbContext) Line 1408 C++

libproj_d.dll!osgeo::proj::common::IdentifiedObject::_isEquivalentTo(const
osgeo::proj::common::IdentifiedObject * otherIdObj,
osgeo::proj::util::IComparable::Criterion criterion, const
std::shared_ptr<osgeo::proj::io::DatabaseContext> & dbContext) Line 938 C++

libproj_d.dll!osgeo::proj::common::IdentifiedObject::_isEquivalentTo(const
osgeo::proj::util::IComparable * other,
osgeo::proj::util::IComparable::Criterion criterion, const
std::shared_ptr<osgeo::proj::io::DatabaseContext> & dbContext) Line 923 C++
  libproj_d.dll!osgeo::proj::common::ObjectUsage::_isEquivalentTo(const
osgeo::proj::util::IComparable * other,
osgeo::proj::util::IComparable::Criterion criterion, const
std::shared_ptr<osgeo::proj::io::DatabaseContext> & dbContext) Line 1280 C++
  libproj_d.dll!osgeo::proj::datum::Datum::_isEquivalentTo(const
osgeo::proj::util::IComparable * other,
osgeo::proj::util::IComparable::Criterion criterion, const
std::shared_ptr<osgeo::proj::io::DatabaseContext> & dbContext) Line 222 C++

libproj_d.dll!osgeo::proj::datum::GeodeticReferenceFrame::_isEquivalentTo(const
osgeo::proj::util::IComparable * other,
osgeo::proj::util::IComparable::Criterion criterion, const
std::shared_ptr<osgeo::proj::io::DatabaseContext> & dbContext) Line 1385 C++
  libproj_d.dll!osgeo::proj::crs::SingleCRS::baseIsEquivalentTo(const
osgeo::proj::util::IComparable * other,
osgeo::proj::util::IComparable::Criterion criterion, const
std::shared_ptr<osgeo::proj::io::DatabaseContext> & dbContext) Line 1346 C++
  libproj_d.dll!osgeo::proj::crs::DerivedCRS::_isEquivalentTo(const
osgeo::proj::util::IComparable * other,
osgeo::proj::util::IComparable::Criterion criterion, const
std::shared_ptr<osgeo::proj::io::DatabaseContext> & dbContext) Line 3556 C++
  libproj_d.dll!osgeo::proj::crs::ProjectedCRS::_isEquivalentTo(const
osgeo::proj::util::IComparable * other,
osgeo::proj::util::IComparable::Criterion criterion, const
std::shared_ptr<osgeo::proj::io::DatabaseContext> & dbContext) Line 4047 C++
  libproj_d.dll!osgeo::proj::util::IComparable::isEquivalentTo(const
osgeo::proj::util::IComparable * other,
osgeo::proj::util::IComparable::Criterion criterion, const
std::shared_ptr<osgeo::proj::io::DatabaseContext> & dbContext) Line 708 C++
  libproj_d.dll!proj_is_equivalent_to_internal(pj_ctx * ctx, const PJconsts
* obj, const PJconsts * other, PJ_COMPARISON_CRITERION criterion) Line 1313
C++
  libproj_d.dll!proj_is_equivalent_to_with_ctx(pj_ctx * ctx, const PJconsts
* obj, const PJconsts * other, PJ_COMPARISON_CRITERION criterion) Line 1354
C++

Thanks!
-- 
Peter Townsend
Senior Software Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20210929/583d4272/attachment.html>


More information about the PROJ mailing list