PostGIS  2.2.7dev-r@@SVN_REVISION@@
static POINTARRAY* gml_reproject_pa ( POINTARRAY pa,
int  srid_in,
int  srid_out 
)
static

Use Proj4 to reproject a given POINTARRAY.

Definition at line 282 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().

283 {
284  projPJ in_pj, out_pj;
285  char *text_in, *text_out;
286 
287  if (srid_in == SRID_UNKNOWN) return pa; /* nothing to do */
288  if (srid_out == SRID_UNKNOWN) gml_lwpgerror("invalid GML representation", 3);
289 
290  text_in = GetProj4StringSPI(srid_in);
291  text_out = GetProj4StringSPI(srid_out);
292 
293  in_pj = lwproj_from_string(text_in);
294  out_pj = lwproj_from_string(text_out);
295 
296  lwfree(text_in);
297  lwfree(text_out);
298 
299  if ( ptarray_transform(pa, in_pj, out_pj) == LW_FAILURE )
300  {
301  elog(ERROR, "gml_reproject_pa: reprojection failed");
302  }
303 
304  pj_free(in_pj);
305  pj_free(out_pj);
306 
307  return pa;
308 }
void lwfree(void *mem)
Definition: lwutil.c:214
static void gml_lwpgerror(char *msg, int error_code)
Definition: lwgeom_in_gml.c:67
#define LW_FAILURE
Definition: liblwgeom.h:64
projPJ lwproj_from_string(const char *txt)
Get a projection from a string representation.
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
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: