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

REF: Make CRS methods inheritable #902

Merged
merged 1 commit into from Aug 17, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/history.rst
Expand Up @@ -4,6 +4,8 @@ Change Log
Latest
------
- REF: Handle deprecation of proj_context_set_autoclose_database (issue #866)
- REF: Make CRS methods inheritable (issue #847)
- ENH: Added :attr:`pyproj.crs.CRS.is_derived` (pull #902)
- DOC: Improve FAQ text about CRS formats (issue #789)
- BUG: Add PyPy cython array implementation (issue #854)
- BUG: Fix spelling for
Expand Down
14 changes: 13 additions & 1 deletion pyproj/_crs.pyx
Expand Up @@ -2490,7 +2490,7 @@ cdef class _CRS(Base):
)

if not (
self.is_bound or proj_is_derived_crs(self.context, self.projobj)
self.is_bound or self.is_derived
):
self._coordinate_operation = False
return None
Expand Down Expand Up @@ -2971,6 +2971,18 @@ cdef class _CRS(Base):
return self.source_crs.is_geocentric
return self._type == PJ_TYPE_GEOCENTRIC_CRS

@property
def is_derived(self):
"""
.. versionadded:: 3.2.0

Returns
-------
bool:
True if CRS is a Derived CRS.
"""
return proj_is_derived_crs(self.context, self.projobj) == 1

def _equals(self, _CRS other, bint ignore_axis_order):
if ignore_axis_order:
# Only to be used with DerivedCRS/ProjectedCRS/GeographicCRS
Expand Down