function getlocations_normalizelng in Get Locations 7
Same name and namespace in other branches
- 7.2 getlocations.module \getlocations_normalizelng()
Normalizes a longitude to the [-180,180] range. Longitudes above 180 or below -180 are wrapped.
@type Number
Parameters
{Number} lng The longitude to normalize, in degrees.:
Return value
Returns the longitude, fit within the [-180,180] range.
3 calls to getlocations_normalizelng()
- getlocations_fields_handler_argument_bbox::_convert_bbox_coords in modules/
getlocations_fields/ handlers/ getlocations_fields_handler_argument_bbox.inc - Split BBOX string into {left, bottom, right, top}
- getlocations_fields_save_locations in modules/
getlocations_fields/ getlocations_fields.module - getlocations_latlon_check in ./
getlocations.module - Function to check a lat,lon string
File
- ./
getlocations.module, line 6498 - getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_normalizelng($lng) {
if ($lng % 360 == 180) {
return 180;
}
while ($lng > 180) {
$lng -= 360;
}
while ($lng < -180) {
$lng += 360;
}
return $lng;
}