PostGIS  3.0.0dev-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 124 of file lwgeodetic.c.

Referenced by gbox_centroid(), and ptarray_force_geodetic().

125 {
126 
127  if ( lat > 360.0 )
128  lat = remainder(lat, 360.0);
129 
130  if ( lat < -360.0 )
131  lat = remainder(lat, -360.0);
132 
133  if ( lat > 180.0 )
134  lat = 180.0 - lat;
135 
136  if ( lat < -180.0 )
137  lat = -180.0 - lat;
138 
139  if ( lat > 90.0 )
140  lat = 180.0 - lat;
141 
142  if ( lat < -90.0 )
143  lat = -180.0 - lat;
144 
145  return lat;
146 }
Here is the caller graph for this function: