PostGIS
3.4.0dev-r@@SVN_REVISION@@
◆
lwprint_normalize_latlon()
static void lwprint_normalize_latlon
(
double *
lat
,
double *
lon
)
static
Definition at line
37
of file
lwprint.c
.
38
{
39
/* First remove all the truly excessive trips around the world via up or down. */
40
while
(*lat > 270)
41
{
42
*lat -= 360;
43
}
44
while
(*lat < -270)
45
{
46
*lat += 360;
47
}
48
49
/* Now see if latitude is past the top or bottom of the world.
50
* Past 90 or -90 puts us on the other side of the earth,
51
* so wrap latitude and add 180 to longitude to reflect that. */
52
if
(*lat > 90)
53
{
54
*lat = 180 - *lat;
55
*lon += 180;
56
}
57
if
(*lat < -90)
58
{
59
*lat = -180 - *lat;
60
*lon += 180;
61
}
62
/* Now make sure lon is in the normal range. Wrapping longitude
63
* has no effect on latitude. */
64
while
(*lon > 180)
65
{
66
*lon -= 360;
67
}
68
while
(*lon < -180)
69
{
70
*lon += 360;
71
}
72
}
Referenced by
lwdoubles_to_latlon()
.
Here is the caller graph for this function:
liblwgeom
lwprint.c
Generated by
1.9.1