PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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 336 of file lwgeom_in_gml.c.

337{
338 LWPROJ *lwp;
339 char text_in[16];
340 char text_out[16];
341
342 if (epsg_in == SRID_UNKNOWN)
343 return pa; /* nothing to do */
344
345 if (epsg_out == SRID_UNKNOWN)
346 {
347 gml_lwpgerror("invalid GML representation", 3);
348 return NULL;
349 }
350
351 snprintf(text_in, 16, "EPSG:%d", epsg_in);
352 snprintf(text_out, 16, "EPSG:%d", epsg_out);
353
354
355 lwp = lwproj_from_str(text_in, text_out);
356 if (!lwp)
357 {
358 gml_lwpgerror("Could not create LWPROJ*", 57);
359 return NULL;
360 }
361
362 if (ptarray_transform(pa, lwp) == LW_FAILURE)
363 {
364 elog(ERROR, "gml_reproject_pa: reprojection failed");
365 return NULL;
366 }
367 proj_destroy(lwp->pj);
368 pfree(lwp);
369
370 return pa;
371}
int ptarray_transform(POINTARRAY *pa, LWPROJ *pj)
#define LW_FAILURE
Definition liblwgeom.h:96
#define SRID_UNKNOWN
Unknown SRID value.
Definition liblwgeom.h:215
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,...
static void gml_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
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: