You are here

function AddressToGeo::latRad in Geolocation Address Link 8

Helper for getZoom().

1 call to AddressToGeo::latRad()
AddressToGeo::getZoom in src/AddressToGeo.php
A method to roughly calculate the right zoom level for a place.

File

src/AddressToGeo.php, line 300

Class

AddressToGeo
Class AddressToGeo.

Namespace

Drupal\geolocation_address_link

Code

function latRad($lat) {
  $sin = sin($lat * pi() / 180);
  $radX2 = log((1 + $sin) / (1 - $sin)) / 2;
  return max(min($radX2, pi()), -pi()) / 2;
}