Notice: Undefined index: field_event_address in openlayers_use_geocoder_submit() (line 312 of C:\xampp\htdocs\commons73dev\profiles\commons\modules\contrib\geofield\geofield.widgets.openlayers.inc).
User error: geocoder_widget_get_field_value: You must pass either $source_field_values OR $entity in geocoder_widget_get_field_value() (line 183 of C:\xampp\htdocs\commons73dev\profiles\commons\modules\contrib\geocoder\geocoder.widget.inc).

Whenever I click to autofill from the addressfield geofield entry (linked to addressfield), I always get the undefined index notice on the field entity I created with addressfield ('isset' issue maybe?), and apparently nothing I set is getting passed to the widget as valid inputs. With the combination of components and how they pass data - plus, the myriad of selection possibilities in formatting and data types - I honestly don't know if my setup choices are even close to being correct. I do know that the actual address I'm testing with is correct and verified by USPS and Visa lookups as valid and complete - so - is addressfield 'broken', or is the valid value not accepted or converted correctly... or any clue where it's wonky?

I have API keys for MapQuest (and CloudMade), nothing for Yahoo - and - Google v2 is selected, just for non-api testing to see if anything is working. No combinations I've tried seem to work at all. I haven't even gotten to views yet, so this is still at the content type setup stage and testing the 'add' page for a modified Debut Event.

My preference is to use MapQuest via openLayers for the map display on the completed event page. As seen in the screen-grab, there's no map (openLayer, passed from addressfield - or -addressfield to geofield) showing up in the preview. I'm not sure if that is due to bad/unacceptable values = no display, or if openLayers won't display this way. I've also tried using geofield addressfield as the 'From' component, but after a throbber spin the openLayer map doesn't change at all, and there's absolutely no errors or other messages to explain the unsuccessful results.

FWIW... This was installed on a local server running Commons-7.x-3.x-dev, with it's D7.15 core.

CommentFileSizeAuthor
Preview2.png38.84 KBHumanTex
Event-content.png47.96 KBHumanTex
Preview-event.png416.36 KBHumanTex
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

netbek’s picture

In the field instance settings of Event Geofield, make sure "Geocode from field" is set to Event Address. The "Find using.." button on http://drupal.org/files/Preview-event.png should say "Find using Event Address".

HumanTex’s picture

I've tried that as well... the Preview-event.png image was just one of my many attempts while using geofield instead.

After more testing, I notice that when setting the map to use addressfield it does place a very small marker on the map - but - it doesn't center and zoom. I'll assume that's an openLayer issue and not a geocoder one.

However - when trying a preview while using that same map connection to addressfield instead of geofield, I'm now getting an exception error from geoPHP. I have no idea which component feeds data to it to result in the exception.

Exception: Only NDR (little endian) SKB format is supported at the moment in WKB->getGeometry() (line 48 of C:\xampp\htdocs\commons73dev\profiles\commons\modules\contrib\geophp\geoPHP\lib\adapters\WKB.class.php).

netbek’s picture

Great, then it works as expected if geocoding from addressfield. Auto-center/zooming the map to the geocoded values would be nice, though.

Check out #1728420: OL map widget element_validate broken for a possible patch tested with latest dev of geofield, geocoder, geophp. It's an ongoing issue #1651200-5: Fatal error: Call to undefined method geoPHP::geosInstalled() and might not work for everyone (see #16).

HumanTex’s picture

I pulled from Git instead of patching, but the error persisted after several cleared caches. With some experimentation, the NDR exception seems to occur when Google is selected under the 'geocode' drop-down for GeoField in my 'field_event_geofield'... and not when MapQuest Nominatim is selected. That change alone lets the preview get rendered without error - but - after that, there's no marker produced on the openLayer map when clicking the 'find using...' button, and still no map gets displayed in the preview section.

As suggested (http://drupal.org/node/1651200), here's a one-shot form submission on a preview for a new 'Event' content item, as a backtrace... https://dl.dropbox.com/u/8729396/OL_backtrace.zip . That's the one that produces the NDR error everytime.

At any rate, I'm going to do some methodical testing with different settings accross all the various components to get a better idea of what does what, and whatever doesn't work like I think they might. I'm not in any mad rush to get this completed, so I'll test whatever I can when there's something worth trying.

netbek’s picture

If you want to see if the patch in #1728420-1: OL map widget element_validate broken works, you'll have to apply it to the latest dev geofield. It's not been committed because it's still up for debate/testing. I've tried the latest dev of geofield. Without the patch, both node preview and save fails when geocoding from addressfield using Google Geocoder. My error is the same as yours but with a slightly different order of functions called. I've yet to try the other geocoders. With the patch applied, no problems.

Thanks for the backtrace. Looks like the field formatter is trying to load WKT as WKB data on node preview. If the patch doesn't work for you, then maybe hook_field_prepare_view needs to implemented in geofield, similar to the existing hook_field_presave, to ensure that the field value is in the correct format.

Otherwise, the $items array passed to geofield_field_formatter_view has an extra items for the button (use_geocoder) when adding/editing an entity with a geofield. But it's probably a dirty hack to check for its presence because it doesn't address the root of the problem.

Some relevant lines from the backtrace quoted below if anyone wants to take this up. Note the geoPHP::load('POINT(-85.6620691 43.01672250000003)', 'wkb') part.

    [3] => Array
        (
            [file] => C:\xampp\htdocs\commons73dev\profiles\commons\modules\contrib\geofield\geofield.formatters.inc
            [line] => 379
            [function] => load
            [class] => geoPHP
            [type] => ::
            [args] => Array
                (
                    [0] => POINT(-85.6620691 43.01672250000003)
                    [1] => wkb
                )
        )

    [4] => Array
        (
            [file] => C:\xampp\htdocs\commons73dev\profiles\commons\modules\contrib\geofield\geofield.formatters.inc
            [line] => 323
            [function] => _geofield_openlayers_formatter
            [args] => Array
                (
                    [0] => geofield_formatter_map
                    [1] => Array
                        (
                            [0] => Array
                                (
                                    [geom] => POINT(-85.6620691 43.01672250000003)
                                    [use_geocoder] => Find using Event Address field
                                )
                        )
                )
        )
HumanTex’s picture

Ooops... guess I should have opened it to code before I assumed. After some manual editing to get the patch in place (I know - I really should learn how for windows)... it's working great. I switched back to Google for both the geofield and openLayer fields, switched the display formats to Geofield Map for geofield, and then openLayer for openLayer map - now I get the expected behavior for 'find using', and a somewhat better-zoomed and centered display on the resulting map in the preview. All with no notices/warnings at all.

I still plan on going through settings in more detail to find out how things tick since I'm still a little foggy on why MapQuest maps show for Google settings, but I'm not going to complain one bit when the results are what I was hoping for. Thanks for the timely help with the great modules netbek... very much appreciated!

netbek’s picture

Status: Active » Fixed

Glad it works, HumanTex. If you encounter further Exception: Only NDR (little endian) SKB format errors, please post at #1728420: OL map widget element_validate broken so the maintainers don't have to check multiple threads for error reports.

Marking as fixed because the initial post has been taken care of. However, anyone interested in debugging the WKT/WKB issue further, see #5 and #1728420: OL map widget element_validate broken.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

edit for field reference correction - they were backwards