PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwproj_from_str_pipeline()

LWPROJ* lwproj_from_str_pipeline ( const char *  str_pipeline,
bool  is_forward 
)

Allocate a new LWPROJ containing the reference to the PROJ's PJ using a PROJ pipeline definition:

Parameters
str_pipelinethe coordinate operation pipeline string. Either:
  • urn:ogc:def:coordinateOperation:AUTHORITY::CODE
  • a PROJ pipeline: +proj=pipeline ...
  • concatenated operations: urn:ogc:def:coordinateOperation,coordinateOperation:EPSG::3895,coordinateOperation:EPSG::1618
  • any other coordinate operation accepted via proj_create()
is_fowardwhether to execute the the pipeline in a forward or inverse direction.

Definition at line 122 of file liblwgeom/lwgeom_transform.c.

123 {
124  /* Usable inputs? */
125  if (!str_pipeline)
126  return NULL;
127 
128  PJ* pj = proj_create(PJ_DEFAULT_CTX, str_pipeline);
129  if (!pj)
130  return NULL;
131 
132  /* check we have a transform, not a crs */
133  if (proj_is_crs(pj))
134  return NULL;
135 
136  /* Add in an axis swap if necessary */
137  PJ* pj_norm = proj_normalize_for_visualization(PJ_DEFAULT_CTX, pj);
138  if (!pj_norm)
139  pj_norm = pj;
140  /* Swap is not a copy of input? Clean up input */
141  else if (pj != pj_norm)
142  proj_destroy(pj);
143 
144  /* Allocate and populate return value */
145  LWPROJ *lp = lwalloc(sizeof(LWPROJ));
146  lp->pj = pj_norm; /* Caller is going to have to explicitly proj_destroy this */
147  lp->pipeline_is_forward = is_forward;
148 
149  /* this is stuff for geography calculations; doesn't matter here */
151  lp->source_semi_major_metre = DBL_MAX;
152  lp->source_semi_minor_metre = DBL_MAX;
153  return lp;
154 }
#define LW_FALSE
Definition: liblwgeom.h:94
void * lwalloc(size_t size)
Definition: lwutil.c:227
bool pipeline_is_forward
Definition: liblwgeom.h:49
uint8_t source_is_latlong
Definition: liblwgeom.h:52
double source_semi_major_metre
Definition: liblwgeom.h:54
double source_semi_minor_metre
Definition: liblwgeom.h:55
PJ * pj
Definition: liblwgeom.h:46

References LW_FALSE, lwalloc(), LWPROJ::pipeline_is_forward, LWPROJ::pj, LWPROJ::source_is_latlong, LWPROJ::source_semi_major_metre, and LWPROJ::source_semi_minor_metre.

Referenced by lwgeom_transform_pipeline().

Here is the call graph for this function:
Here is the caller graph for this function: