PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ gml_reproject_pa()

static POINTARRAY* gml_reproject_pa ( POINTARRAY pa,
int  srid_in,
int  srid_out 
)
static

Use Proj4 to reproject a given POINTARRAY.

Definition at line 297 of file lwgeom_in_gml.c.

References gml_lwpgerror(), LW_FAILURE, lwfree(), lwproj_from_string(), 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().

298 {
299  projPJ in_pj, out_pj;
300  char *text_in, *text_out;
301 
302  if (srid_in == SRID_UNKNOWN) return pa; /* nothing to do */
303  if (srid_out == SRID_UNKNOWN) gml_lwpgerror("invalid GML representation", 3);
304 
305  text_in = GetProj4StringSPI(srid_in);
306  text_out = GetProj4StringSPI(srid_out);
307 
308  in_pj = lwproj_from_string(text_in);
309  out_pj = lwproj_from_string(text_out);
310 
311  lwfree(text_in);
312  lwfree(text_out);
313 
314  if ( ptarray_transform(pa, in_pj, out_pj) == LW_FAILURE )
315  {
316  elog(ERROR, "gml_reproject_pa: reprojection failed");
317  }
318 
319  pj_free(in_pj);
320  pj_free(out_pj);
321 
322  return pa;
323 }
static void gml_lwpgerror(char *msg, __attribute__((__unused__)) int error_code)
Definition: lwgeom_in_gml.c:82
void lwfree(void *mem)
Definition: lwutil.c:244
int ptarray_transform(POINTARRAY *pa, projPJ inpj, projPJ outpj)
Transform given POINTARRAY from inpj projection to outpj projection.
#define LW_FAILURE
Definition: liblwgeom.h:78
projPJ lwproj_from_string(const char *txt)
Get a projection from a string representation.
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:187
Here is the call graph for this function:
Here is the caller graph for this function: