PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwgeom_transform_from_str()

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

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

401 {
402  PJ *pj = proj_create_crs_to_crs(NULL, instr, outstr, NULL);
403  if (!pj)
404  {
405  PJ *pj_in = proj_create(NULL, instr);
406  if (!pj_in)
407  {
408  proj_errno_reset(NULL);
409  lwerror("could not parse proj string '%s'", instr);
410  }
411  proj_destroy(pj_in);
412 
413  PJ *pj_out = proj_create(NULL, outstr);
414  if (!pj_out)
415  {
416  proj_errno_reset(NULL);
417  lwerror("could not parse proj string '%s'", outstr);
418  }
419  proj_destroy(pj_out);
420  lwerror("%s: Failed to transform", __func__);
421  return LW_FAILURE;
422  }
423 
424  LWPROJ *lp = lwproj_from_PJ(pj, LW_FALSE);
425 
426  int ret = lwgeom_transform(geom, lp);
427 
428  proj_destroy(pj);
429  lwfree(lp);
430 
431  return ret;
432 }
int lwgeom_transform(LWGEOM *geom, LWPROJ *pj)
Transform (reproject) a geometry in-place.
LWPROJ * lwproj_from_PJ(PJ *pj, int8_t extra_geography_data)
Allocate a new LWPROJ containing the reference to the PROJ's PJ If extra_geography_data is true,...
#define LW_FALSE
Definition: liblwgeom.h:108
#define LW_FAILURE
Definition: liblwgeom.h:110
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

References LW_FAILURE, LW_FALSE, lwerror(), lwfree(), lwgeom_transform(), and lwproj_from_PJ().

Referenced by transform_geom().

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