You are here

function location_latlon_rough in Location 5

Same name and namespace in other branches
  1. 5.3 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

2 calls to location_latlon_rough()
location_nearby_postalcodes_bylocation in ./location.inc
Takes an location and a distance and returns an array of all postal-codes (from all countries that are supported) within the specified distance of the specified location.
location_search_results in ./location.module

File

./location.inc, line 771

Code

function location_latlon_rough($location = array()) {
  if (!isset($location['country']) || !isset($location['postal_code'])) {
    return NULL;
  }
  $latlon_function = 'location_latlon_rough_' . $location['country'];
  if (function_exists($latlon_function)) {
    return $latlon_function($location);
  }
  else {
    return NULL;
  }
}