PostGIS  3.4.0dev-r@@SVN_REVISION@@
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages

◆ ptarray_force_geodetic()

static int ptarray_force_geodetic ( POINTARRAY pa)
static

Definition at line 3159 of file lwgeodetic.c.

3160 {
3161  uint32_t t;
3162  int changed = LW_FALSE;
3163  POINT4D pt;
3164 
3165  assert(pa);
3166 
3167  for ( t=0; t < pa->npoints; t++ )
3168  {
3169  getPoint4d_p(pa, t, &pt);
3170  if ( pt.x < -180.0 || pt.x > 180.0 || pt.y < -90.0 || pt.y > 90.0 )
3171  {
3172  pt.x = longitude_degrees_normalize(pt.x);
3173  pt.y = latitude_degrees_normalize(pt.y);
3174  ptarray_set_point4d(pa, t, &pt);
3175  changed = LW_TRUE;
3176  }
3177  }
3178  return changed;
3179 }
#define LW_FALSE
Definition: liblwgeom.h:94
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:125
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:93
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
Definition: lwgeom_api.c:369
double longitude_degrees_normalize(double lon)
Convert a longitude to the range of -180,180.
Definition: lwgeodetic.c:106
double latitude_degrees_normalize(double lat)
Convert a latitude to the range of -90,90.
Definition: lwgeodetic.c:133
double x
Definition: liblwgeom.h:414
double y
Definition: liblwgeom.h:414
uint32_t npoints
Definition: liblwgeom.h:427

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().

Here is the call graph for this function:
Here is the caller graph for this function: