function location_has_coordinates in GMap Module 5
1 call to location_has_coordinates()
File
- ./
gmap_location.compat.inc, line 28 - Backwards compatibility functions for using gmap with Location 2.x.
Code
function location_has_coordinates($location, $canonical = FALSE) {
// Locations that have been fully saved have an up to date source.
if ($canonical) {
return $location['source'] != LOCATION_LATLON_UNDEFINED;
}
// Otherwise, we need to do the full checks.
// If latitude or longitude are empty / missing
if (empty($location['latitude']) || empty($location['longitude'])) {
return FALSE;
}
// If the latitude or longitude are zeroed (Although it could be a good idea to relax this slightly sometimes)
if (_location_floats_are_equal($location['latitude'], 0.0) || _location_floats_are_equal($location['longitude'], 0.0)) {
return FALSE;
}
return TRUE;
}