PostGIS  2.1.10dev-r@@SVN_REVISION@@
double latitude_degrees_normalize ( double  lat)

Convert a latitude to the range of -90,90.

Parameters
latlatitude in degrees

Definition at line 110 of file lwgeodetic.c.

Referenced by gbox_centroid(), and ptarray_force_geodetic().

111 {
112 
113  if ( lat > 360.0 )
114  lat = remainder(lat, 360.0);
115 
116  if ( lat < -360.0 )
117  lat = remainder(lat, -360.0);
118 
119  if ( lat > 180.0 )
120  lat = 180.0 - lat;
121 
122  if ( lat < -180.0 )
123  lat = -180.0 - lat;
124 
125  if ( lat > 90.0 )
126  lat = 180.0 - lat;
127 
128  if ( lat < -90.0 )
129  lat = -180.0 - lat;
130 
131  return lat;
132 }

Here is the caller graph for this function: