Index: google.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/geocoding/google.inc,v
retrieving revision 1.8
diff -u -p -r1.8 google.inc
--- google.inc	17 Jun 2008 16:33:42 -0000	1.8
+++ google.inc	28 Aug 2008 20:13:29 -0000
@@ -89,30 +89,24 @@ function google_geocode_location($locati
       break;
   }
 
-  $service_url = 'http://maps.google.com/maps/geo?output=xml&key='. variable_get('location_geocode_google_apikey', '') .'&q=';
+  $service_url = 'http://maps.google.com/maps/geo?output=csv&key='. variable_get('location_geocode_google_apikey', '') .'&q=';
 
   $http_reply = drupal_http_request($service_url . urlencode($query));
+  
+  $r = array();
+  list($r['code'], $r['acc'], $r['lat'], $r['lon']) = explode(',', $http_reply->data);
+  $r = array(
+    'code' => intval($r['code']),
+    'acc' => intval($r['acc']),
+    'lon' => floatval($r['lon']),
+    'lat' => floatval($r['lat']),
+  );
 
-  $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 < 3) {
+  if (($r['code'] != 200) || ($r['acc'] < 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]);
+  return $r;
 }
 
 /**
