You are here

function ip_geoloc_earth_radius in IP Geolocation Views & Maps 7

Same name and namespace in other branches
  1. 8 ip_geoloc_api.inc \ip_geoloc_earth_radius()

Get radius of the Earth at a given latitude.

Parameters

float $latitude: The latitude for which to calculate Earth's radius

Return value

float The radius of Earth at the given latitude

1 call to ip_geoloc_earth_radius()
ip_geoloc_earth_distance in ./ip_geoloc_api.inc
Returns the distance between two points on the earth's surface.

File

./ip_geoloc_api.inc, line 754
API functions of IP geolocation module

Code

function ip_geoloc_earth_radius($latitude) {
  $lat = deg2rad($latitude);
  $x = cos($lat) / ip_geoloc_earth_radius_semimajor();
  $y = sin($lat) / ip_geoloc_earth_radius_semiminor();
  return 1.0 / sqrt($x * $x + $y * $y);
}