You are here

function location_latlon_rough in Location 7.5

Same name and namespace in other branches
  1. 5.3 location.inc \location_latlon_rough()
  2. 5 location.inc \location_latlon_rough()
  3. 6.3 location.inc \location_latlon_rough()
  4. 7.3 location.inc \location_latlon_rough()
  5. 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

$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

NULL if data cannont 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
location_views_proximity_get_reference_location in ./location.views.inc
Helper function for proximity handlers. Retrieves the coordinates of the location that this field measures distances against.

File

./location.inc, line 260

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);
  }
}