Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Use proj_is_equivalent_to_with_ctx in the place of proj_is_equivalent_to internally #667

Merged
merged 1 commit into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Change Log
* ENH: Added :meth:`pyproj.transformer.TransformerGroup.download_grids` (pull #643)
* ENH: Added transformation grid sync API/CLI (issue #572)
* ENH: Add support for coordinate systems with CRS using CF conventions (issue #536)
* ENH: Use `proj_is_equivalent_to_with_ctx` in the place of `proj_is_equivalent_to` internally (issue #666)

2.6.1
~~~~~
Expand Down
11 changes: 6 additions & 5 deletions pyproj/_crs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,12 @@ cdef class Base:
return self.to_wkt(pretty=True)

def _is_exact_same(self, Base other):
return proj_is_equivalent_to(
self.projobj, other.projobj, PJ_COMP_STRICT) == 1
return proj_is_equivalent_to_with_ctx(
self.context, self.projobj, other.projobj, PJ_COMP_STRICT) == 1

def _is_equivalent(self, Base other):
return proj_is_equivalent_to(
self.projobj, other.projobj, PJ_COMP_EQUIVALENT) == 1
return proj_is_equivalent_to_with_ctx(
self.context, self.projobj, other.projobj, PJ_COMP_EQUIVALENT) == 1

def __eq__(self, other):
if not isinstance(other, Base):
Expand Down Expand Up @@ -2938,7 +2938,8 @@ cdef class _CRS(Base):
def _equals(self, _CRS other, bint ignore_axis_order):
if ignore_axis_order:
# Only to be used with DerivedCRS/ProjectedCRS/GeographicCRS
return proj_is_equivalent_to(
return proj_is_equivalent_to_with_ctx(
self.context,
self.projobj,
other.projobj,
PJ_COMP_EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS,
Expand Down
5 changes: 3 additions & 2 deletions pyproj/proj.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ cdef extern from "proj.h":
PJ_COMP_EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS

void proj_destroy(PJ *obj)
int proj_is_equivalent_to(const PJ *obj, const PJ* other,
PJ_COMPARISON_CRITERION criterion)
int proj_is_equivalent_to_with_ctx(PJ_CONTEXT *ctx,
const PJ *obj, const PJ *other,
PJ_COMPARISON_CRITERION criterion)

const char* proj_get_id_auth_name(const PJ *obj, int index)
const char* proj_get_id_code(const PJ *obj, int index)
Expand Down