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_create_crs_to_crs_from_pj for creating transformer PJ* #800

Closed
wants to merge 1 commit into from
Closed
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 pyproj/_crs.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ cdef class _CRS(Base):
cdef readonly object _geodetic_crs
cdef readonly object _coordinate_system
cdef readonly object _coordinate_operation
cdef PJ* get_projobj(self)
3 changes: 3 additions & 0 deletions pyproj/_crs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2334,6 +2334,9 @@ cdef class _CRS(Base):
self._set_base_info()
CRSError.clear()

cdef PJ* get_projobj(self):
return self.projobj

@property
def axis_info(self):
"""
Expand Down
7 changes: 4 additions & 3 deletions pyproj/_transformer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,12 @@ cdef class _Transformer(Base):
north_lat_degree,
)
transformer.context = pyproj_context_create()
transformer.projobj = proj_create_crs_to_crs(
transformer.projobj = proj_create_crs_to_crs_from_pj(
transformer.context,
cstrencode(crs_from.srs),
cstrencode(crs_to.srs),
crs_from.get_projobj(),
crs_to.get_projobj(),
pj_area_of_interest,
NULL,
)
finally:
if pj_area_of_interest != NULL:
Expand Down
8 changes: 7 additions & 1 deletion pyproj/proj.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ cdef extern from "proj.h":
double *t, size_t st, size_t nt
) nogil
ctypedef struct PJ_AREA
PJ *proj_create_crs_to_crs(PJ_CONTEXT *ctx, const char *source_crs, const char *target_crs, PJ_AREA *area)
PJ *proj_create_crs_to_crs_from_pj(
PJ_CONTEXT *ctx,
PJ *source_crs,
PJ *target_crs,
PJ_AREA *area,
const char* const *options,
)

ctypedef enum PJ_COMPARISON_CRITERION:
PJ_COMP_STRICT
Expand Down