PostGIS  3.4.0dev-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 300 of file lwgeom_in_gml.c.

301 {
302  LWPROJ *lwp;
303  char text_in[16];
304  char text_out[16];
305 
306  if (epsg_in == SRID_UNKNOWN)
307  return pa; /* nothing to do */
308 
309  if (epsg_out == SRID_UNKNOWN)
310  {
311  gml_lwpgerror("invalid GML representation", 3);
312  return NULL;
313  }
314 
315  snprintf(text_in, 16, "EPSG:%d", epsg_in);
316  snprintf(text_out, 16, "EPSG:%d", epsg_out);
317 
318 
319  lwp = lwproj_from_str(text_in, text_out);
320  if (!lwp)
321  {
322  gml_lwpgerror("Could not create LWPROJ*", 57);
323  return NULL;
324  }
325 
326  if (ptarray_transform(pa, lwp) == LW_FAILURE)
327  {
328  elog(ERROR, "gml_reproject_pa: reprojection failed");
329  return NULL;
330  }
331  proj_destroy(lwp->pj);
332  pfree(lwp);
333 
334  return pa;
335 }
int ptarray_transform(POINTARRAY *pa, LWPROJ *pj)
#define LW_FAILURE
Definition: liblwgeom.h:96
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:215
static void gml_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
Definition: lwgeom_in_gml.c:81
PJ * pj
Definition: liblwgeom.h:46

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: