PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ ptarray_force_geodetic()

static int ptarray_force_geodetic ( POINTARRAY pa)
static

Definition at line 2747 of file lwgeodetic.c.

References getPoint4d_p(), latitude_degrees_normalize(), longitude_degrees_normalize(), LW_FALSE, LW_TRUE, POINTARRAY::npoints, ptarray_set_point4d(), POINT4D::x, and POINT4D::y.

Referenced by lwline_force_geodetic(), lwpoint_force_geodetic(), and lwpoly_force_geodetic().

2748 {
2749  int t;
2750  int changed = LW_FALSE;
2751  POINT4D pt;
2752 
2753  assert(pa);
2754 
2755  for ( t=0; t < pa->npoints; t++ )
2756  {
2757  getPoint4d_p(pa, t, &pt);
2758  if ( pt.x < -180.0 || pt.x > 180.0 || pt.y < -90.0 || pt.y > 90.0 )
2759  {
2760  pt.x = longitude_degrees_normalize(pt.x);
2761  pt.y = latitude_degrees_normalize(pt.y);
2762  ptarray_set_point4d(pa, t, &pt);
2763  changed = LW_TRUE;
2764  }
2765  }
2766  return changed;
2767 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:536
double x
Definition: liblwgeom.h:336
int npoints
Definition: liblwgeom.h:355
double longitude_degrees_normalize(double lon)
Convert a longitude to the range of -180,180.
Definition: lwgeodetic.c:82
double latitude_degrees_normalize(double lat)
Convert a latitude to the range of -90,90.
Definition: lwgeodetic.c:109
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
double y
Definition: liblwgeom.h:336
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:231
Here is the call graph for this function:
Here is the caller graph for this function: