function geocoder_yandex in Geocoder 7
Process Address.
1 call to geocoder_yandex()
- geocoder_yandex_field in plugins/
geocoder_handler/ yandex.inc - Plugin callback.
1 string reference to 'geocoder_yandex'
- yandex.inc in plugins/
geocoder_handler/ yandex.inc
File
- plugins/
geocoder_handler/ yandex.inc, line 29
Code
function geocoder_yandex($address, $options = array()) {
global $base_path;
$geocoder_settings = variable_get('geocoder_settings', array());
if (!empty($geocoder_settings['geocoder_apikey_yandex'])) {
$consumer_key = $geocoder_settings['geocoder_apikey_yandex'];
}
else {
throw new Exception(t('You must set up your Yandex API key. Click !config', array(
'!config' => l(t('here'), $base_path . 'admin/config/content/geocoder'),
)));
}
$params = array(
'format' => 'json',
'results' => 1,
'key' => $consumer_key,
'geocode' => $address,
);
$request = drupal_http_request('http://geocode-maps.yandex.ru/1.x/?' . http_build_query($params));
$data = json_decode($request->data);
return _geocoder_yandex_geometry($data);
}