You are here

function geocoder_yahoo in Geocoder 7

Process Markup.

1 call to geocoder_yahoo()
geocoder_yahoo_field in plugins/geocoder_handler/yahoo.inc
Plugin callback.
1 string reference to 'geocoder_yahoo'
yahoo.inc in plugins/geocoder_handler/yahoo.inc

File

plugins/geocoder_handler/yahoo.inc, line 29

Code

function geocoder_yahoo($address, $options = array()) {
  global $base_path;
  $geocoder_settings = variable_get('geocoder_settings', array());
  if (!empty($geocoder_settings['geocoder_apikey_yahoo'])) {
    $consumer_key = $geocoder_settings['geocoder_apikey_yahoo'];
  }
  else {
    throw new Exception(t('You must set up your Yahoo API key. Click !config', array(
      '!config' => l(t('here'), $base_path . 'admin/config/content/geocoder'),
    )));
  }
  $request = drupal_http_request('http://where.yahooapis.com/geocode?location=' . urlencode($address) . "&flags=J&appid={$consumer_key}");
  $data = json_decode($request->data);
  geophp_load();
  return _geocoder_yahoo_geometry($data);
}