Index: location.views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/location.views.inc,v
retrieving revision 1.16.2.4
diff -u -p -r1.16.2.4 location.views.inc
--- location.views.inc	29 Sep 2010 12:41:28 -0000	1.16.2.4
+++ location.views.inc	9 Nov 2010 16:51:38 -0000
@@ -504,6 +504,21 @@ function location_views_proximity_get_re
         }
       }
       break;
+    case 'address':
+    case 'address_default':
+      // Force default for country.
+      if ($options['origin'] == 'address_default') {
+        $options['country'] = variable_get('location_default_country', 'us');
+      }
+      // Address lookup.
+      if (!empty($options['address']) && !empty($options['country'])) {
+        $coords = location_views_proximity_geocode($options['address'], $options['country']);
+        if ($coords) {
+          $coordinates['latitude'] = (float) $coords['lat'];
+          $coordinates['longitude'] = (float) $coords['lon'];
+        }
+      }
+      break;
     case 'php':
       ob_start();
       $result = eval($options['php_code']);
@@ -545,3 +560,53 @@ function location_views_proximity_get_re
 
   return $coordinates;
 }
+
+
+/*
+ * based on google_geocode_location
+ */
+function location_views_proximity_geocode($address, $country) {
+  if (function_exists('gmap_get_key')) {
+    $key = gmap_get_key();
+  }
+  else {
+    $key = variable_get('location_geocode_google_apikey', '');
+  }
+  $query = array(
+    'key' => $key,
+    'sensor' => 'false', // Required by TOS.
+    'output' => 'xml',
+  //'ll' => 0,
+  //'spn' => 0,
+    'gl' => $country,
+    'q' => $address,
+  );
+
+  $url = url('http://maps.google.com/maps/geo', array(
+    'query' => $query,
+    'external' => TRUE,
+  ));
+
+  $http_reply = drupal_http_request($url);
+
+  $status_code_match = array();
+  preg_match('/<code>(.*)<\/code>/', $http_reply->data, $status_code_match);
+  $status_code = $status_code_match[1];
+  if ($status_code != 200) {
+    return NULL;
+  }
+
+  $accuracy_code_match = array();
+  preg_match('/Accuracy="([0-9])"/', $http_reply->data, $accuracy_code_match);
+  $accuracy_code = $accuracy_code_match[1];
+  if ($accuracy_code < variable_get('location_geocode_' . $country . 'google_accuracy_code', variable_get('location_geocode_google_minimum_accuracy', '3'))) {
+    return NULL;
+  }
+
+  $latlon_match = array();
+  preg_match('/<coordinates>(.*)<\/coordinates>/', $http_reply->data, $latlon_match);
+
+  $latlon_exploded = explode(',', $latlon_match[1]);
+
+  return array('lat' => $latlon_exploded[1], 'lon' => $latlon_exploded[0]);
+}
Index: handlers/location_views_handler_filter_proximity.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/handlers/location_views_handler_filter_proximity.inc,v
retrieving revision 1.3.2.5
diff -u -p -r1.3.2.5 location_views_handler_filter_proximity.inc
--- handlers/location_views_handler_filter_proximity.inc	29 Sep 2010 14:04:55 -0000	1.3.2.5
+++ handlers/location_views_handler_filter_proximity.inc	9 Nov 2010 16:51:39 -0000
@@ -22,6 +22,7 @@ class location_views_handler_filter_prox
         'latitude' => '',
         'longitude' => '',
         'postal_code' => '',
+        'address_string' => '',
         'country' => '',
         'php_code' => '',
         'nid_arg' => '',
@@ -78,6 +79,8 @@ class location_views_handler_filter_prox
         'static' => t('Static  Latitude / Longitude'),
         'postal' => t('Postal Code / Country'),
         'postal_default' => t('Postal Code (assume default country)'),
+        'address' => t('Address / Country'),
+        'address_default' => t('Address (assume default country)'),
         'php' => t('Use PHP code to determine latitude/longitude'),
         'nid_arg' => t("Node's Latitude / Longitude from views nid argument"),
         'uid_arg' => t("User's Latitude / Longitude from views uid argument"),
@@ -137,13 +140,21 @@ class location_views_handler_filter_prox
       '#dependency' => array('edit-options-origin' => array('postal', 'postal_default')),
       '#weight' => 3,
     );
+    $form['value']['address_string'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Address'),
+      '#default_value' => $this->value['address_string'],
+      '#process' => array('views_process_dependency'),
+      '#dependency' => array('edit-options-origin' => array('address', 'address_default')),
+      '#weight' => 3,
+    );
     $form['value']['country'] = array(
       '#type' => 'select',
       '#title' => t('Country'),
       '#options' => array('' => '') + location_get_iso3166_list(),
       '#default_value' => $this->value['country'],
       '#process' => array('views_process_dependency'),
-      '#dependency' => array('edit-options-origin' => array('postal')),
+      '#dependency' => array('edit-options-origin' => array('postal', 'address')),
       '#weight' => 4,
     );
 
@@ -263,7 +274,10 @@ class location_views_handler_filter_prox
     if ($origin != 'postal' && $origin != 'postal_default') {
       unset($form[$key]['postal_code']);
     }
-    if ($origin != 'postal') {
+    if ($origin != 'address' && $origin != 'address_default') {
+      unset($form[$key]['address_string']);
+    }
+    if ($origin != 'postal' && $origin != 'address') {
       unset($form[$key]['country']);
     }
 
