function location_latlon_exact in Location 5
Same name and namespace in other branches
- 5.3 location.inc \location_latlon_exact()
- 6.3 location.inc \location_latlon_exact()
- 7.5 location.inc \location_latlon_exact()
- 7.3 location.inc \location_latlon_exact()
- 7.4 location.inc \location_latlon_exact()
Currently, this is not a priority until there is an implementable use for exact longitude, latitude coordinates for an location. The idea is that this call will eventually retrieve information through a web-service. Whereas location_latlon_rough() returns an approximate lat/lon pair based strictly on the postal code where this lat/lon pair is pulled from a database table, this function is intended to send the entire location to a web-service and to retrieve exact lat/lon coordinates.
Parameters
$location: An array where -> the key values are 'street', 'additional', 'province', 'country', 'postal_code' -> the values are: 'street' => the string representing the street location (REQUIRED) 'additional' => the string representing the additional street location portion in the location form 'city' => the city name (REQUIRED) 'province' => the province code defined in the country-specific include file 'country' => the lower-case of the two-letter ISO code (REQUIRED) 'postal_code' => the postal-code (REQUIRED)
Return value
NULL if the delegated-to function that does the actual look-up does not exist. If the appropriate function exists, then this function returns an associative array where 'lon' => A floating point number for the longitude coordinate of the parameter location 'lat' => A floating point number for the latitude coordinate of the parameter location
3 calls to location_latlon_exact()
- location_extra_form_submit in ./
location.module - location_nodeapi in ./
location.module - Implementation of hook_nodeapi().
- location_user in ./
location.module
File
- ./
location.inc, line 1019
Code
function location_latlon_exact($location = array()) {
$country = trim($location['country']);
$service = variable_get('location_geocode_' . $country, 'none');
if (!empty($country) && $service != 'none') {
// figure out what the exact function should be
if (strpos($service, '|')) {
$exact_latlon_function = 'location_geocode_' . $country . '_' . $service;
}
else {
$exact_latlon_function = $service . '_geocode_location';
}
if (function_exists($exact_latlon_function)) {
return $exact_latlon_function($location);
}
else {
return NULL;
}
}
return NULL;
}