function location_latlon_rough in Location 7.3
Same name and namespace in other branches
- 5.3 location.inc \location_latlon_rough()
- 5 location.inc \location_latlon_rough()
- 6.3 location.inc \location_latlon_rough()
- 7.5 location.inc \location_latlon_rough()
- 7.4 location.inc \location_latlon_rough()
Takes an location and returns a "rough" latitude/longitude pair based on the postal code data available for the given country.
Parameters
array $location: An associative array $location where 'street' => the street portion of the location 'additional' => additional street portion of the location 'province' => the province, state, or territory 'country' => lower-cased two-letter ISO code (REQUIRED) 'postal_code' => international postal code (REQUIRED)
Return value
array|null NULL if data cannot be found. Otherwise, an associative array where 'lat' => is a floating point of the latitude coordinate of this location 'lon' => is a floating point of the longitude coordinate of this location
Related topics
2 calls to location_latlon_rough()
- location_handler_argument_location_proximity::calculate_coords in handlers/
location_handler_argument_location_proximity.inc - Calculate coords.
- location_views_proximity_get_reference_location in ./
location.views.inc - Helper function for proximity handlers.
File
- ./
location.inc, line 364 - Public API for the Location module.
Code
function location_latlon_rough($location = array()) {
if (!isset($location['country']) || !isset($location['postal_code'])) {
return NULL;
}
location_load_country($location['country']);
$latlon_function = 'location_latlon_rough_' . $location['country'];
if (function_exists($latlon_function) && ($result = $latlon_function($location))) {
return $result;
}
else {
return location_latlon_rough_default($location);
}
}