PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ gml_reproject_pa()

static POINTARRAY* gml_reproject_pa ( POINTARRAY pa,
int32_t  epsg_in,
int32_t  epsg_out 
)
static

Use Proj to reproject a given POINTARRAY.

Definition at line 379 of file lwgeom_in_gml.c.

380 {
381  PJ *pj;
382  LWPROJ *lwp;
383  char text_in[16];
384  char text_out[16];
385 
386  if (epsg_in == SRID_UNKNOWN)
387  return pa; /* nothing to do */
388 
389  if (epsg_out == SRID_UNKNOWN)
390  {
391  gml_lwpgerror("invalid GML representation", 3);
392  return NULL;
393  }
394 
395  snprintf(text_in, 16, "EPSG:%d", epsg_in);
396  snprintf(text_out, 16, "EPSG:%d", epsg_out);
397  pj = proj_create_crs_to_crs(NULL, text_in, text_out, NULL);
398 
399  lwp = lwproj_from_PJ(pj, LW_FALSE);
400  if (!lwp)
401  {
402  proj_destroy(pj);
403  gml_lwpgerror("Could not create LWPROJ*", 57);
404  return NULL;
405  }
406 
407  if (ptarray_transform(pa, lwp) == LW_FAILURE)
408  {
409  proj_destroy(pj);
410  elog(ERROR, "gml_reproject_pa: reprojection failed");
411  return NULL;
412  }
413  proj_destroy(pj);
414  pfree(lwp);
415 
416  return pa;
417 }
#define LW_FALSE
Definition: liblwgeom.h:108
int ptarray_transform(POINTARRAY *pa, LWPROJ *pj)
#define LW_FAILURE
Definition: liblwgeom.h:110
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 SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:229
static void gml_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
Definition: lwgeom_in_gml.c:81

References gml_lwpgerror(), LW_FAILURE, LW_FALSE, lwproj_from_PJ(), ptarray_transform(), and SRID_UNKNOWN.

Referenced by parse_gml_curve(), parse_gml_data(), parse_gml_line(), parse_gml_linearring(), parse_gml_patch(), parse_gml_point(), parse_gml_polygon(), and parse_gml_triangle().

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