PostGIS  2.4.9dev-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 296 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().

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