You are here

function location_latlon_rough in Location 5.3

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

File

./location.inc, line 269

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)) {
    return $latlon_function($location);
  }
  else {
    return location_latlon_rough_default($location);
  }
}