You are here

function location_country_bounds in Location 7.5

Same name and namespace in other branches
  1. 5.3 location.inc \location_country_bounds()
  2. 6.3 location.inc \location_country_bounds()
  3. 7.3 location.inc \location_country_bounds()
  4. 7.4 location.inc \location_country_bounds()

Get an appropriate bounding box for showing an entire country on a map. Target is a bounding box large enough to show the country in both spherical mercator and mercator projections.

Parameters

$location: Either a location array or a country code.

Return value

An array with 'minlng', 'minlat', 'maxlng', and 'maxlat' elements.

File

./location.inc, line 342

Code

function location_country_bounds($location = array()) {
  if (!is_array($location)) {
    $location = array(
      'country' => $location,
    );
  }
  if (!empty($location['country'])) {
    location_load_country($location['country']);
  }
  $country_bounds_function = 'location_bounds_' . $location['country'];
  if (function_exists($country_bounds_function)) {
    return $country_bounds_function();
  }
  else {
    return array(
      'minlng' => -180.0,
      'minlat' => -90.0,
      'maxlng' => 180.0,
      'maxlat' => 90.0,
    );
  }
}