You are here

function ip_geoloc_earth_radius in IP Geolocation Views & Maps 8

Same name and namespace in other branches
  1. 7 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

2 calls to ip_geoloc_earth_radius()
IpGeoLocAPI::earthDistance in src/Services/IpGeoLocAPI.php
Returns the distance between two points on the earth's surface.
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 749
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);
}