Index: geo.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geo/geo.inc,v
retrieving revision 1.15
diff -u -p -r1.15 geo.inc
--- geo.inc	18 Jun 2009 01:24:11 -0000	1.15
+++ geo.inc	4 Sep 2009 08:43:56 -0000
@@ -13,7 +13,7 @@ function geo_backend_type() {
     switch ($GLOBALS['db_type']) {
       case 'pgsql':
         // use the postgis backend if installed
-        if (db_result(db_query("SELECT 1 FROM pg_catalog.pg_proc 
+        if (db_result(db_query("SELECT 1 FROM pg_catalog.pg_proc
           WHERE proname = 'postgis_version'"))) {
           $backend = 'postgis';
         }
@@ -64,7 +64,7 @@ function geo_field_select($field) {
   $alias = str_replace('.', '_', $field);
   $alias = preg_replace('/_geo$/', '', $alias);
 
-  return " SRID($field) as {$alias}_srid, 
+  return " SRID($field) as {$alias}_srid,
     AsBinary($field) AS {$alias}_wkb,
     AsBinary(Envelope($field)) AS {$alias}_bbox,
     AsBinary(Centroid($field)) AS $alias}_centroid";
@@ -261,7 +261,7 @@ function geo_gis_input_selector($default
   return $form;
 }
 
-function geo_wkt_validate($wkt, $geo_type = NULL, $srid = GEO_DEFAULT_SRID) {
+function geo_wkt_validate($wkt, $geo_type = NULL, $srid = GEO_SRID_DEFAULT) {
 
   // TODO this should probabaly be moved into db-specific backend files.
   $type = db_result(@db_query("SELECT GeometryType(GeomFromText('%s'))", $wkt));
Index: geo.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geo/geo.module,v
retrieving revision 1.27
diff -u -p -r1.27 geo.module
--- geo.module	7 Aug 2009 16:55:12 -0000	1.27
+++ geo.module	4 Sep 2009 08:43:57 -0000
@@ -4,20 +4,20 @@
  * Geo: Geospatial storage and retrieval.
  */
 
-define(GEO_SRID_DEFAULT, 4326);
-define(GEO_DEGREE_M, 111206);
+define('GEO_SRID_DEFAULT', 4326);
+define('GEO_DEGREE_M', 111206);
 
-define(GEO_TYPE_POINT, 0);
-define(GEO_TYPE_CURVE, 2);
-define(GEO_TYPE_LINESTRING, 3);
-define(GEO_TYPE_SURFACE, 4);
-define(GEO_TYPE_POLYGON, 5);
-define(GEO_TYPE_COLLECTION, 6);
-define(GEO_TYPE_MULTIPOINT, 7);
-define(GEO_TYPE_MULTICURVE, 8);
-define(GEO_TYPE_MULTILINESTRING, 9);
-define(GEO_TYPE_MULTISURFACE, 10);
-define(GEO_TYPE_MULTIPOLYGON, 11);
+define('GEO_TYPE_POINT', 0);
+define('GEO_TYPE_CURVE', 2);
+define('GEO_TYPE_LINESTRING', 3);
+define('GEO_TYPE_SURFACE', 4);
+define('GEO_TYPE_POLYGON', 5);
+define('GEO_TYPE_COLLECTION', 6);
+define('GEO_TYPE_MULTIPOINT', 7);
+define('GEO_TYPE_MULTICURVE', 8);
+define('GEO_TYPE_MULTILINESTRING', 9);
+define('GEO_TYPE_MULTISURFACE', 10);
+define('GEO_TYPE_MULTIPOLYGON', 11);
 
 /**
  * Call an API function from the geo backend databases.
@@ -188,7 +188,7 @@ function geo_wkb_get_data($wkb = NULL, $
  */
 function geo_units($unit = NULL) {
   $units = array(
-    'mi' => t('Miles'),  
+    'mi' => t('Miles'),
     'km' => t('Kilometers'),
     'm'  => t('Meters'),
   );
@@ -268,7 +268,7 @@ function geo_elements() {
 }
 
 function theme_geo_fields($element) {
-  return $element['#children'];
+  return isset($element['#children']) ? $element['#children'] : '';
 }
 
 /**
@@ -355,7 +355,7 @@ function geo_gis_input_info($gis_type = 
 }
 
 function geo_set_pre_render(&$element) {
-  if (!isset($element['#pre_render']) 
+  if (!isset($element['#pre_render'])
     || !in_array('geo_field_convert_value', $element['#pre_render'])) {
     $element['#pre_render'][] = 'geo_field_convert_value';
   }
@@ -379,10 +379,15 @@ function geo_field_convert_value($elemen
 function geo_set_value($item, $theme) {
   init_theme();
   $registry = theme_get_registry();
-  
+
   if ($format = $registry[$theme]['gis input']) {
-    $value = geo_wkb_get_data($item['wkb'], $format);
-    $item[$format] = $value['value'];
+    if (isset($item['wkb'])) {
+      $value = geo_wkb_get_data($item['wkb'], $format);
+      $item[$format] = $value['value'];
+    }
+    else {
+      $item[$format] = '';
+    }
   }
   return $item;
 }
Index: modules/geo_field/geo_field.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geo/modules/geo_field/geo_field.module,v
retrieving revision 1.25
diff -u -p -r1.25 geo_field.module
--- modules/geo_field/geo_field.module	7 Aug 2009 16:54:23 -0000	1.25
+++ modules/geo_field/geo_field.module	4 Sep 2009 08:43:57 -0000
@@ -21,8 +21,6 @@ function geo_field_info() {
  * Implementation of hook_field_settings().
  */
 function geo_field_settings($op, $field) {
-  $field_name = $field['field_name'];
-  
   switch ($op) {
     case 'form':
       $form = array();
@@ -45,10 +43,13 @@ function geo_field_settings($op, $field)
 
     case 'save':
       return array('srid', 'geo_type');
-    
+
     case 'database columns':
-      return geo('schema_field', $field['geo_type']);
-    
+      if (!empty($field['geo_type'])) {
+        return geo('schema_field', $field['geo_type']);
+      }
+      break;
+
     case 'views data':
       // Start with default views data, as constructed by CCK.
       $data = content_views_field_views_data($field);
@@ -107,7 +108,7 @@ function geo_field($op, &$node, $field, 
         FROM {". $db_info['table'] ."} WHERE vid = %d", $node->vid);
 
       $ret = array();
-      while ($row = db_fetch_array($res)) { 
+      while ($row = db_fetch_array($res)) {
         $delta = isset($row['delta']) ? $row['delta'] : 0;
         $ret[$delta]['gis type'] = $field['geo_type'];
         foreach ($row as $k => $v) {
@@ -187,8 +188,13 @@ function geo_field_widget(&$form, &$form
   foreach ($items as $key => $item) {
     // Convert from the storage format (wkb) to the element's expected format.
     if ($info['gis input']) {
-      $data = geo_wkb_get_data($item['wkb'], $info['gis input']);
-      $items[$key] = $data['value'];
+      if (isset($item['wkb'])) {
+        $data = geo_wkb_get_data($item['wkb'], $info['gis input']);
+        $items[$key] = $data['value'];
+      }
+      else {
+        $items[$key] = '';
+      }
     }
   }
 
