? .DS_Store ? geo_openlayers.patch ? modules/.DS_Store Index: includes/geo.api.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/geo/includes/geo.api.inc,v retrieving revision 1.11 diff -u -p -r1.11 geo.api.inc --- includes/geo.api.inc 26 Apr 2010 05:40:43 -0000 1.11 +++ includes/geo.api.inc 20 May 2010 20:56:27 -0000 @@ -117,6 +117,7 @@ function geo_list($reset = FALSE) { * API function: Load a geometry dataset. */ function geo_load($values = NULL) { + global $db_type; // Already loaded, simply return it. if (is_object($values) && method_exists($values, 'gid')) { return $values; @@ -156,12 +157,20 @@ function geo_load($values = NULL) { } } } - $handler = $values['handler']; + if (isset($values['handler'])) { + $handler = $values['handler']; + } } - // Use the default non-database handler, which is GeoSimple by default. + // If there's a database handler available, try to load it first. Otherwise, go with the default. if (!isset($handler)) { - $handler = variable_get('geo_simple_handler', 'GeoSimple'); + if ($db_type == 'pgsql') { + $handler = 'GeoSQLPostGIS'; + } else if ($db_type == 'mysqli') { + $handler = 'GeoSQLMySQL'; + } else { + $handler = variable_get('geo_simple_handler', 'GeoSimple'); + } } if (geo_handler_load($handler)) { @@ -365,7 +374,7 @@ function geo_value($input, $output_forma // Nothing to do here. if ($output_format == $input_format) return $input; - $geo = geo_load(); + $geo = geo_load(array('handler' => 'GeoSimple')); // Set up the geometry object based on the input parameter. switch ($input_format) { Index: includes/handlers/geo_simple.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/geo/includes/handlers/geo_simple.inc,v retrieving revision 1.7 diff -u -p -r1.7 geo_simple.inc --- includes/handlers/geo_simple.inc 26 Apr 2010 05:40:43 -0000 1.7 +++ includes/handlers/geo_simple.inc 20 May 2010 20:56:27 -0000 @@ -718,7 +718,11 @@ class GeoSimple implements GeoInterface public function parseWKB($g, $format = NULL) { $format = strtolower($format); if (isset($g->$format)) return $g->$format; - $result = geo_wkb_get_data($g->asBinary(), $format); - return $g->$format = $result['value']; + if (method_exists($g, 'asBinary')) { + $result = geo_wkb_get_data($g->asBinary(), $format); + return $g->$format = $result['value']; + } + + return NULL; } } 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.35 diff -u -p -r1.35 geo_field.module --- modules/geo_field/geo_field.module 26 Apr 2010 05:40:43 -0000 1.35 +++ modules/geo_field/geo_field.module 20 May 2010 20:56:27 -0000 @@ -21,7 +21,11 @@ function geo_field_info() { * Implementation of hook_field_settings(). */ function geo_field_settings($op, $field) { - if (!$geo = geo_load(array('name' => $field['field_name']))) { + if (isset($field['field_name'])) { + if (!$geo = geo_load(array('name' => $field['field_name']))) { + $geo = geo_sql_load(); + } + } else { $geo = geo_sql_load(); } @@ -93,12 +97,14 @@ function geo_field($op, &$node, $field, $items[$delta]['gis type'] = $field['geo_type']; $items[$delta]['geo'] = $items[$delta]['wkb'] = db_decode_blob($row['geo']); + $items[$delta]['wkt'] = geo_value($items[$delta]['geo'], 'wkt'); } // Unset the value if it's not actually populated. foreach($items as $delta => $item) { if (empty($item['geo'])) unset($items[$delta]); } + //kpr($items); return array($field['field_name'] => $items); case 'validate':