PostGIS 3.0.6dev-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 367 of file lwgeom_in_gml.c.

368{
369 PJ *pj;
370 LWPROJ *lwp;
371 char text_in[16];
372 char text_out[16];
373
374 if (epsg_in == SRID_UNKNOWN)
375 return pa; /* nothing to do */
376
377 if (epsg_out == SRID_UNKNOWN)
378 {
379 gml_lwpgerror("invalid GML representation", 3);
380 return NULL;
381 }
382
383 snprintf(text_in, 16, "EPSG:%d", epsg_in);
384 snprintf(text_out, 16, "EPSG:%d", epsg_out);
385 pj = proj_create_crs_to_crs(NULL, text_in, text_out, NULL);
386
387 lwp = lwproj_from_PJ(pj, LW_FALSE);
388 if (!lwp)
389 {
390 proj_destroy(pj);
391 gml_lwpgerror("Could not create LWPROJ*", 57);
392 return NULL;
393 }
394
395 if (ptarray_transform(pa, lwp) == LW_FAILURE)
396 {
397 proj_destroy(pj);
398 elog(ERROR, "gml_reproject_pa: reprojection failed");
399 return NULL;
400 }
401 proj_destroy(pj);
402 pfree(lwp);
403
404 return pa;
405}
#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)

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: