PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ lwgeom_transform_from_str()

int lwgeom_transform_from_str ( LWGEOM geom,
const char *  instr,
const char *  outstr 
)

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

158 {
159  LWPROJ *lp = lwproj_from_str(instr, outstr);
160  if (!lp)
161  {
162  PJ *pj_in = proj_create(PJ_DEFAULT_CTX, instr);
163  if (!pj_in)
164  {
165  proj_errno_reset(NULL);
166  lwerror("could not parse proj string '%s'", instr);
167  }
168  proj_destroy(pj_in);
169 
170  PJ *pj_out = proj_create(PJ_DEFAULT_CTX, outstr);
171  if (!pj_out)
172  {
173  proj_errno_reset(NULL);
174  lwerror("could not parse proj string '%s'", outstr);
175  }
176  proj_destroy(pj_out);
177  lwerror("%s: Failed to transform", __func__);
178  return LW_FAILURE;
179  }
180  int ret = lwgeom_transform(geom, lp);
181  proj_destroy(lp->pj);
182  lwfree(lp);
183  return ret;
184 }
int lwgeom_transform(LWGEOM *geom, LWPROJ *pj)
Transform given LWGEOM geometry from inpj projection to outpj projection.
LWPROJ * lwproj_from_str(const char *str_in, const char *str_out)
Allocate a new LWPROJ containing the reference to the PROJ's PJ If extra_geography_data is true,...
#define LW_FAILURE
Definition: liblwgeom.h:96
void lwfree(void *mem)
Definition: lwutil.c:242
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
PJ * pj
Definition: liblwgeom.h:46

References LW_FAILURE, lwerror(), lwfree(), lwgeom_transform(), lwproj_from_str(), and LWPROJ::pj.

Referenced by transform_geom().

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