? feeds1.patch
? geo_field.patch
Index: geo_field.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geo/modules/geo_field/geo_field.module,v
retrieving revision 1.30
diff -u -p -r1.30 geo_field.module
--- geo_field.module	9 Dec 2009 17:34:03 -0000	1.30
+++ geo_field.module	24 Dec 2009 03:23:41 -0000
@@ -183,3 +183,51 @@ function geo_field_widget(&$form, &$form
 
   return $element;
 }
+
+/**
+ * Implementation of feeds_node_processor_targets_alter().
+ *
+ * Adds support for geo fields to feeds.
+ */
+function geo_field_feeds_node_processor_targets_alter(&$targets, $content_type) {
+  $info = content_types($content_type);
+  $fields = array();
+  if (isset($info['fields']) && count($info['fields'])) {
+    foreach ($info['fields'] as $field_name => $field) {
+      if (in_array($field['type'], array('geo'))) {
+        $fields[$field_name] = isset($field['widget']['label']) ? $field['widget']['label'] : $field_name;
+      }
+    }
+  }
+  foreach ($fields as $k => $name) {
+    $targets[$k] = array(
+      'name' => $name,
+      'callback' => 'geo_field_feeds_set_target',
+      'description' => t('The CCK !name field of the node.', array('!name' => $name)),
+    );
+  }
+}
+
+/**
+* Feeds callback for mapping. 
+*
+* Here is where the actual mapping happens. Map feeds data to the geo field.
+*/
+function geo_field_feeds_set_target($node, $target, $value) {
+  
+  $field = isset($node->$target) ? $node->$target : array();
+  
+  // Handle multiple value fields.
+  if (is_array($value)) {
+    $i = 0;
+    foreach ($value as $v) {
+    	$field[$i]['geo'] = $v;
+      $i++;
+    }
+  }
+  else {
+    $field[0]['geo'] = $value;
+  }
+
+  $node->$target = $field;
+}
