I created a content type and set the OL WKT to Hidden.

Each time I try to create or modify a node, this error:
Fatal error: Cannot unset string offsets in cck/content.module on line 1248

So, I change to OL Geocoder and the node can be modified. Perhaps this is why the module is not working for me, it is not clear to me whether the field must be set to Hidden for the module to work.

Here is a discussion of the error:
http://drupal.org/node/1102822

Comments

cmjns’s picture

Add the following to rules_geocoder_widget(), just after line 68:

$element['#default_value'] = $items;

So this:

/**
 * Implementation of hook_widget().
 */
function rules_geocoder_widget(&$form, &$form_state, $field, $items, $delta = 0) {
  $element = openlayers_cck_widget($form, $form_state, $field, $items, $delta);
  $field = NULL;
  $element['#type'] = 'value';
  $element['#default_value'] = $items;
  return $element;
}

No time to roll a patch right this sec, but will try to circle back.

itserich’s picture

Thanks cmjns.

First, I just want to say I think there is a lot of interest in "batch geocoding" and I am not sure if this module should be able to do that, but it seems like it could. When I filter for modules by Category - Location Rules Geocoder does not show up. So, just want to comment that adding it might increase visibility.

For anyone else trying the patch, I think the closing ?> needs to be removed.

Then, I was able to create and modify nodes. However, they were still not geocoded.

I did get this error in Watchdog:

Invalid argument supplied for foreach() in /rules_geocoder/rules_geocoder.rules.inc on line 113.

These are lines 110 - 115:

  $source_strings = array();
  
  foreach ($source_fields as $source_field) {
    foreach ($node->{$source_field} as $field_instance) {
      $source_strings[] = $field_instance['value'];
    }

Thank you.

basvredeling’s picture

I can confirm the solution in #1 works.
#2 should be a new issue

henrrrik’s picture

Assigned: Unassigned » henrrrik
Status: Active » Fixed

Thanks everyone.

I've committed the fix in #1 and tagged a new release.

#2: Make sure that the fields you're encoding exist in the node type in question. The module doesn't currently verify this, so you can mess up by adding the wrong one. If it still doesn't work, please add a new issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.