PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ longitude_degrees_normalize()

double longitude_degrees_normalize ( double  lon)

Convert a longitude to the range of -180,180.

Parameters
lonlongitude in degrees

Definition at line 106 of file lwgeodetic.c.

107{
108 if ( lon > 360.0 )
109 lon = remainder(lon, 360.0);
110
111 if ( lon < -360.0 )
112 lon = remainder(lon, -360.0);
113
114 if ( lon > 180.0 )
115 lon = -360.0 + lon;
116
117 if ( lon < -180.0 )
118 lon = 360 + lon;
119
120 if ( lon == -180.0 )
121 return 180.0;
122
123 if ( lon == -360.0 )
124 return 0.0;
125
126 return lon;
127}

Referenced by gbox_centroid(), and ptarray_force_geodetic().

Here is the caller graph for this function: