function _geocoder_yandex_geometry in Geocoder 7
Plugin callback.
1 call to _geocoder_yandex_geometry()
- geocoder_yandex in plugins/
geocoder_handler/ yandex.inc - Process Address.
File
- plugins/
geocoder_handler/ yandex.inc, line 84
Code
function _geocoder_yandex_geometry(&$data) {
geophp_load();
if (isset($data->error)) {
$args = array(
'@status' => $data->error->status,
'@error' => $data->error->message,
);
$msg = t('Yandex API has reported an error.\\nStatus: @status\\nError: @error', $args);
throw new Exception($msg);
}
if ($data->response->GeoObjectCollection->metaDataProperty->GeocoderResponseMetaData->found === 0) {
return NULL;
}
$loc = explode(' ', $data->response->GeoObjectCollection->featureMember[0]->GeoObject->Point->pos);
return new Point($loc[0], $loc[1]);
}