PostGIS  2.5.7dev-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 133 of file lwgeodetic.c.

134 {
135 
136  if ( lat > 360.0 )
137  lat = remainder(lat, 360.0);
138 
139  if ( lat < -360.0 )
140  lat = remainder(lat, -360.0);
141 
142  if ( lat > 180.0 )
143  lat = 180.0 - lat;
144 
145  if ( lat < -180.0 )
146  lat = -180.0 - lat;
147 
148  if ( lat > 90.0 )
149  lat = 180.0 - lat;
150 
151  if ( lat < -90.0 )
152  lat = -180.0 - lat;
153 
154  return lat;
155 }

Referenced by gbox_centroid(), and ptarray_force_geodetic().

Here is the caller graph for this function: