PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ latitude_degrees_normalize()

double latitude_degrees_normalize ( double  lat)

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

Parameters
latlatitude in degrees

Definition at line 109 of file lwgeodetic.c.

Referenced by gbox_centroid(), and ptarray_force_geodetic().

110 {
111 
112  if ( lat > 360.0 )
113  lat = remainder(lat, 360.0);
114 
115  if ( lat < -360.0 )
116  lat = remainder(lat, -360.0);
117 
118  if ( lat > 180.0 )
119  lat = 180.0 - lat;
120 
121  if ( lat < -180.0 )
122  lat = -180.0 - lat;
123 
124  if ( lat > 90.0 )
125  lat = 180.0 - lat;
126 
127  if ( lat < -90.0 )
128  lat = -180.0 - lat;
129 
130  return lat;
131 }
Here is the caller graph for this function: