function _geolocation_field_precalculate_values in Geolocation Field 7
Helper function. Precalculates values for geolocation field item.
Parameters
array $item: Geolocation field item with the following keys:
- lat: (required) Latitude
- lng: (required) Longitude
Return value
array Geolocation field item with added precalculated values:
- lat_sin: Latitude sine
- lat_cos: Latitude cosine
- lng_rad: Radian longitude
3 calls to _geolocation_field_precalculate_values()
- geolocation_field_presave in ./
geolocation.module - Implements hook_field_presave().
- MigrateGeolocationFieldHandler::prepare in migrate/
destinations/ geolocation.inc - _geolocation_devel_generate in ./
geolocation.devel_generate.inc - Callback for hook_devel_generate().
File
- ./
geolocation.module, line 324 - A geolocation field using the Field API.
Code
function _geolocation_field_precalculate_values(array $item) {
$item['lat_sin'] = sin(deg2rad($item['lat']));
$item['lat_cos'] = cos(deg2rad($item['lat']));
$item['lng_rad'] = deg2rad($item['lng']);
return $item;
}