on Openstreetmap nominatim API the Address resolving does not work properly if the postal codes is requestet AFTER the country, so im moved the postal-code Field in the "geocoder_widget_parse_addressfield"-Funktion (see geocoder.widget.inc) beforde the country like so:

function geocoder_widget_parse_addressfield($field_item) {
  $address = array();

  $address[] = !empty($field_item['organization']) ? $field_item['organization'] : NULL;
  $address[] = !empty($field_item['premise']) ? $field_item['premise'] : NULL;
  $address[] = !empty($field_item['sub_premise']) ? $field_item['sub_premise'] : NULL;
  $address[] = !empty($field_item['thoroughfare']) ? $field_item['thoroughfare'] : NULL;
  $address[] = !empty($field_item['locality']) ? $field_item['locality'] : NULL;
  $address[] = !empty($field_item['administrative_area']) ? $field_item['administrative_area'] : NULL;
  $address[] = !empty($field_item['sub_administrative_area']) ? $field_item['sub_administrative_area'] : NULL;
<strong>
  $address[] = !empty($field_item['postal_code']) ? $field_item['postal_code'] : NULL;</strong>
   
  if (!empty($field_item['country'])) {
    if (module_exists('countries')) {
      $country = country_load($field_item['country']);
      $field_item['country'] = $country->name;
    }
    else {
      // Convert country code to country name.
      include_once DRUPAL_ROOT . '/includes/locale.inc';
      $countries = country_get_list();
      if (array_key_exists($field_item['country'], $countries)) {
        $field_item['country'] = $countries[$field_item['country']];
      }
    }
    $address[] = $field_item['country'];
  }


  return implode(',', array_filter($address));
}

Could anyone reply / confirm to this issue? Does anyone have a better solution?

Also https://www.drupal.org/node/1967520 could maybe fix this but still has "needs review"-status ...maybe anybody can add this to the latest 7.x-1.x-dev ???

Comments

drudev12 created an issue. See original summary.

drudev12’s picture

Pol’s picture

Status: Active » Closed (outdated)