Skip to content

Commit

Permalink
REF: Make CRS methods inheritable
Browse files Browse the repository at this point in the history
  • Loading branch information
snowman2 committed Aug 17, 2021
1 parent 43b7cff commit ea2cc18
Show file tree
Hide file tree
Showing 5 changed files with 389 additions and 41 deletions.
2 changes: 2 additions & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading

0 comments on commit ea2cc18

Please sign in to comment.