function location_country_bounds in Location 7.3
Same name and namespace in other branches
- 5.3 location.inc \location_country_bounds()
- 6.3 location.inc \location_country_bounds()
- 7.5 location.inc \location_country_bounds()
- 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
array $location: Either a location array or a country code.
Return value
array An array with 'minlng', 'minlat', 'maxlng', and 'maxlat' elements.
File
- ./
location.inc, line 451 - Public API for the Location module.
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,
);
}
}