PostGIS  2.1.10dev-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 283 of file lwgeom_in_gml.c.

References getPoint4d_p(), gml_lwerror(), lwfree(), lwproj_from_string(), POINTARRAY::npoints, point4d_transform(), ptarray_set_point4d(), 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().

284 {
285  int i;
286  POINT4D p;
287  projPJ in_pj, out_pj;
288  char *text_in, *text_out;
289 
290  if (srid_in == SRID_UNKNOWN) return pa; /* nothing to do */
291  if (srid_out == SRID_UNKNOWN) gml_lwerror("invalid GML representation", 3);
292 
293  text_in = GetProj4StringSPI(srid_in);
294  text_out = GetProj4StringSPI(srid_out);
295 
296  in_pj = lwproj_from_string(text_in);
297  out_pj = lwproj_from_string(text_out);
298 
299  lwfree(text_in);
300  lwfree(text_out);
301 
302  for (i=0 ; i < pa->npoints ; i++)
303  {
304  getPoint4d_p(pa, i, &p);
305  point4d_transform(&p, in_pj, out_pj);
306  ptarray_set_point4d(pa, i, &p);
307  }
308 
309  pj_free(in_pj);
310  pj_free(out_pj);
311 
312  return pa;
313 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:501
void lwfree(void *mem)
Definition: lwutil.c:190
int npoints
Definition: liblwgeom.h:327
projPJ lwproj_from_string(const char *txt)
Get a projection from a string representation.
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:154
int point4d_transform(POINT4D *pt, projPJ srcpj, projPJ dstpj)
static void gml_lwerror(char *msg, int error_code)
Definition: lwgeom_in_gml.c:68
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:217

Here is the call graph for this function:

Here is the caller graph for this function: