Notice: Undefined index: in geoPHP::load() (line 62 of /Users/pablocc/Sites/bluesparklabs/PDGA/www/sites/all/modules/contrib/geophp/geoPHP/geoPHP.inc).
Exception: geoPHP could not find an adapter of type in geoPHP::load() (line 65 of /Users/pablocc/Sites/bluesparklabs/PDGA/www/sites/all/modules/contrib/geophp/geoPHP/geoPHP.inc). Backtrace:
geoPHP::load(NULL) geofield.widgets.openlayers.inc:167
openlayers_field_widget_form(Array, Array, Array, Array, 'und', Array, 0, Array) field.form.inc:112
This happens due the $items variable is received with empty lat/lon, E.x.:
Array
(
[0] => Array
(
[geom] =>
[geo_type] =>
[lat] =>
[lon] =>
[left] =>
[top] =>
[right] =>
[bottom] =>
[srid] =>
[accuracy] =>
[source] =>
)
)
An attempt to initialize an geoPHP object with empty lat/lon raise the exception.
Comments
Comment #1
citlacom CreditAttribution: citlacom commentedI fixed the previous issue adding a empty check on line 166 of geofield.widgets.openlayers.inc file:
But the then I get other exception due the else block that continue after this condition attempt to execute auto-detect of $item format that is an array instead of string that is what geoPHP expects:
Warning: fwrite() expects parameter 2 to be string, array given in geoPHP::detectFormat() (line 213 of /Users/pablocc/Sites/bluesparklabs/PDGA/www/sites/all/modules/contrib/geophp/geoPHP/geoPHP.inc).
Notice: Undefined index: in geoPHP::load() (line 62 of /Users/pablocc/Sites/bluesparklabs/PDGA/www/sites/all/modules/contrib/geophp/geoPHP/geoPHP.inc).
Exception: geoPHP could not find an adapter of type in geoPHP::load() (line 65 of /Users/pablocc/Sites/bluesparklabs/PDGA/www/sites/all/modules/contrib/geophp/geoPHP/geoPHP.inc). Backtrace:
geoPHP::load(Array) geofield.widgets.openlayers.inc:178
Comment #2
citlacom CreditAttribution: citlacom commentedI did a patch at level of geofield module that fix the problem, I created the issue here although I think is more in the side of Geofield.
Comment #3
PolJust forwarding a bug that has been posted in the OpenLayers project.
Comment #4
GaborTorok CreditAttribution: GaborTorok commentedThe patch fixed the problem form me on current dev.
Setting to review so someone with more knowledge would review it.
Comment #5
Simon Georges CreditAttribution: Simon Georges commentedSeems to be a duplicate of #1881056: Exception: geoPHP could not find an adapter of type in geoPHP::load() (line 54).
Comment #6
kiwimind CreditAttribution: kiwimind commentedI don't think that this is a duplicate of that issue as I've applied the patch in that issue and the error mentioned in the initial post here still remains.
I can't get this patch to apply to current dev version, so am assuming it's going to need rerolling against that. It won't apply either after the patch in #1881056: Exception: geoPHP could not find an adapter of type in geoPHP::load() (line 54) or by itself.
If I get half a chance I'll re-roll it, but not sure when that's likely to happen.
Comment #7
kiwimind CreditAttribution: kiwimind commentedSeems I made time. :)
Re-rolled against current dev.
Comment #8
Brandonian CreditAttribution: Brandonian commentedI believe this is fixed in the latest dev version of Geofield. Please reopen if the issue persists.
Comment #10
jmdeleon CreditAttribution: jmdeleon commentedWas still seeing the exception in the logs with the latest July dev version referred to in #8, preventing content from being saved. Adding empty-check patch described in #1 to July dev resolved the exception.
Comment #11
palamida CreditAttribution: palamida commenteddownload the new geoPHP library (version 1.1) from https://github.com/phayes/geoPHP
put it in sites/all/libraries/
so far so good - back on horse again
Comment #12
johnhanley CreditAttribution: johnhanley commented@palamida,
Thanks for the tip. I added geoPHP as you suggested using 7.x-2.0 and the exception went away.
Cheers,
John
Comment #13
heshanlkAdding the 1.1 version of geoPHP as sites/all/libraries/geophp fixed the issue for me too. I'm not sure if geoPHP or Geofields module are looking for that site/all/libraries path (Geofield says it depends on the geoPHP) and geoPHP ships with 1.1 as well. Little confusing but this fixed the issue. Thanks.
Comment #14
heshanlkThis patch helped me to fix the formatter issue I had with the Geofield Map module.
Comment #15
heshanlkComment #16
muschpusch CreditAttribution: muschpusch commentedSorry tried #14 #7 and #11 all no luck with current dev and geofield map widget enabled...
Comment #17
ledbelly2142 CreditAttribution: ledbelly2142 commentedI am really excited to get geoPHP and openlayers working with GIS data types, this will be a great set of mapping modules.
I realize this issue was closed, but...
I am still have the same issue as well. I thought this might be a library issue pointed out in other posts, but the updated geoPHP lib is in both the module and in 'libraries'.
Here is the error [notice]
Notice: Undefined index: in geoPHP::load() (line 51 of /...../sites/all/libraries/geoPHP/geoPHP.inc).
Exception: geoPHP could not find an adapter of type in geoPHP::load() (line 54 of /....../sites/all/libraries/geoPHP/geoPHP.inc).
I did not apply the patch and did not add an 'empty check' in the geofiled.widgets.openlayers.inc file (seems like this was fixed in the code in the latest geofield module release).
The current foreach statement around line 166 in geofield.widgets.openlayers.inc looks like:
And the Undefined index in geoPHP.inc points to line 51 and 54, looks like this:
Line 51 is $processor_type = $type_map[$type];
and $type_map = geoPHP::getAdapterMap(); is on line 49
The static function getAdapterMap() just returns the adapter array in the adapter folder in the geoPHP lib. I am not sure if the getAdapterMap() function is finding the lib folder, although the lib is in two places (in the module geoPHP folder and in the libraries folder).
looks like:
<?PHP
static function getAdapterMap() {
return array (
'wkt' => 'WKT',
'ewkt' => 'EWKT',
'wkb' => 'WKB',
'ewkb' => 'EWKB',
'json' => 'GeoJSON',
'kml' => 'KML',
'gpx' => 'GPX',
'georss' => 'GeoRSS',
'google_geocode' => 'GoogleGeocode',
'geohash' => 'GeoHash',
);
}
?>
Not sure what the problem is, unless there is never any initial adapter type being specified...
One interesting clue is that when I tried to make a content type, I could not check the "required" field and save. When the required box was checked, the error (when trying to save the content type) was This field [content type name] cannot be left blank.
Any help is greatly appreciated. I running the drupal 7.23 with all the required openlayers modules.
Thanks in advance
Comment #18
ledbelly2142 CreditAttribution: ledbelly2142 commentedI tried to use the patch in #14, but the patch failed with dry run. I patched the geofield_map.module manually with the patch. Still had the same problem when trying to create a node.
I also tried to create a node using the OpenLayers Example Content, with the same failure notice as above.
I would really like to get this working. If there is anything I can do to help, please let me know.
Thank you
Comment #19
muschpusch CreditAttribution: muschpusch commentedSetting this to major since it really breaks stuff...
Comment #20
ezman CreditAttribution: ezman commentedIs this issue something to do with permissions?
I've encountered a similar error message after downloading the latest geoPHP lib to /sites/all/libraries and sticking with the stable versions of the modules.
I then upgraded geofield, geophp, and openlayers to their most recent dev versions, to see if the error had been fixed.
Then I got the error in the title of this report.
I have not tried any of the patches in this report though.
I have moved geoPHP from /sites/all/libraries to the module directory (read this as a possible solution in an old bug report) but all that changed was the path to the source of the error.
When I visit the erroring pages as admin, however, then it works without error.
This makes me wonder if there's a permission that needs setting somewhere. I tried giving all users permission to geocode using all services, but still get the error.
(This may or may not be relevant, but the erroring page only loads the following OpenLayers javascript files:
/sites/all/libraries/openlayers/OpenLayers.js
/sites/all/modules/openlayers/js/openlayers.js
/sites/all/modules/openlayers/plugins/layer_types/openlayers_layer_type_google.js
//maps.googleapis.com/maps/api/js?sensor=false&v=3.5
/sites/all/modules/openlayers/modules/openlayers_views/plugins/layer_types/openlayers_views_vector.js
When viewed as admin (ie when it works) there are more javascript files loaded, starting with:
/sites/all/modules/openlayers/plugins/layer_types/openlayers_layer_type_google.js
I will continue investigating and report any findings back)
Comment #21
ezman CreditAttribution: ezman commentedto add, it doesn't actually work for admin. It goes a step further, by displaying the map and the geocode button on the node add/edit form, but throws the same error when geocoding, and when trying to save the form.
Comment #22
ezman CreditAttribution: ezman commentedOk I found my problem. Hope this may apply to others?
When I updated the GeoPHP library to its latest version, I clicked the github link in #11.
On the github page, if you scroll down, you see:
"Getting Started
The lastest stable version can always be downloaded at: https://github.com/downloads/phayes/geoPHP/geoPHP.tar.gz "
This is not version 1.1 (at the time of me posting this) but version 1.0.
It was only when debugging and comparing geoPHP.inc to the github version that I spotted the mistake.
Instead, download the .zip file linked on the right-hand side of the page.
https://github.com/phayes/geoPHP/archive/master.zip is version 1.1 at the moment.
So, actually putting the correct 1.1 in the /sites/all/modules/geophp/geoPHP directory fixed it for me.
Comment #23
ledbelly2142 CreditAttribution: ledbelly2142 commentedezman,
Thanks for posting. The 'correct' ver 1.1 got me to the next step in creating a node. Thanks for finding the issue. I guess the latest stable version is not 1.1.
Note to self: don't trust links.
Cheers
Comment #24
FrancescoQ CreditAttribution: FrancescoQ commentedUsing last geoPHP works! Anyway i've created this patch, it works with geoPHP provided with module without updating the library
Comment #25
geek-merlinOK, here's how this worked for me:
* updateing geophp module to latest dev
* OR getting current library from https://github.com/phayes/geoPHP/archive/master.zip and put it into sites/all/libraries/geoPHP (case matters!)
Comment #26
basvredelingI concur that #25 works
Comment #27
Brandonian CreditAttribution: Brandonian commentedMarking issue as fixed.