public static function Geocoder::reverse in Geocoder 7.2
Same name and namespace in other branches
- 8.3 src/Geocoder.php \Drupal\geocoder\Geocoder::reverse()
- 8.2 src/Geocoder.php \Drupal\geocoder\Geocoder::reverse()
Reverse geocode coordinates.
Parameters
string|string[] $plugins: The name of the plugin to use or a list of plugins names to use.
double $latitude: The latitude.
double $longitude: The longitude.
array $options (optional): The plugin options.
Return value
\Geocoder\Model\AddressCollection|FALSE
2 calls to Geocoder::reverse()
- geocoder_services_geocoder_reverse_callback in modules/
geocoder_services/ geocoder_services.services.inc - Callback for Revere Geocoding service
- reverse in ./
geocoder.module - The reverse Geocoder API call.
File
- src/
Geocoder.php, line 64
Class
Namespace
Drupal\geocoderCode
public static function reverse($plugins = 'googlemaps', $latitude, $longitude, array $options = array()) {
foreach ((array) $plugins as $plugin) {
$plugin_options = isset($options[$plugin]) ? $options[$plugin] : array();
$plugin = self::getPlugin('Provider', $plugin, $plugin_options);
try {
return $plugin
->reverse($latitude, $longitude);
} catch (InvalidCredentials $e) {
self::log($e
->getMessage(), 'error');
} catch (\Exception $e) {
self::log($e
->getMessage(), 'error');
}
}
$exception = new \Exception(sprintf('No plugin could reverse geocode: "%s %s".', $latitude, $longitude));
self::log($exception
->getMessage(), 'error');
return FALSE;
}