PostGIS  3.3.9dev-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 376 of file lwgeom_in_gml.c.

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

References gml_lwpgerror(), LW_FAILURE, lwproj_from_str(), LWPROJ::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: