I have set a leaflet field formatter for a geofield field. When this geofield contains a linestring, I get Fatal error: Call to a member function getComponents() on a non-object. With a point there is no error, but the displayed map does not contain a marker and cannot be zoomed. I should open another issue for that.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 1912716.patch | 1.14 KB | balagan |
Comments
Comment #1
balagan commentedI get the same error with the beta version, and not sure if it is related to this, but I also got Notice: Undefined index: wkt in leaflet_process_geofield() (line 272 of F:\...\sites\all\modules\leaflet\leaflet.formatters.inc).
Comment #2
balagan commentedI am setting the data of geofield from code, and it contains for example LINESTRING (20.03624 47.9022243, 20.0361933 47.9022289, 20.0362102 47.9022034, 20.0362435 47.9021819, 20.036252 47.9021677)
Maybe I messed up something with my code, but still don't know what.
Comment #3
balagan commentedI had an idea, what might be wrong. I am using version = "7.x-2.0-alpha2+6-dev" of geofield. I have found a code, where the field was set like this:
When I tried this, I got Notice: Undefined index: geom in geofield_field_presave() (line 292 ... so I solved it with
It must be my fault, I have to still find out how to properly set geofield from code. With the wkt array there is no fatal error, just a gray map.
Comment #4
balagan commentedComment #5
balagan commentedJust tried what is proposed in the documentation, but
gives me: Fatal error: Uncaught exception 'Exception' with message 'geoPHP could not find an adapter of type GEOFIELD_INPUT_WKT'
That was with devel version of geoPHP and geofield. With the latest stable versions I get Notice: Undefined index: wkt in geofield_compute_values() (line 191
Comment #6
balagan commentedOk, last night I did some debugging of both leaflet and geofield. It seems the dev version of geofield changed the structure of its array, and no longer uses ['wkt'] dimension, but it introduced the ['geom'] dimension. The dev version of leaflet still does not support it, so I move back this bug to leaflet and attach a patch that is working for me. I think the dev version of Leaflet should support the dev version of geofield.
Comment #7
balagan commentedComment #8
pvhee commentedThanks for finding out the issue that caused this, but I am not sure whether this is a patch we can apply safely in Leaflet. As for now, Leaflet seems to evolve at a faster pace than Geofield, so if we add that patch, the next beta release of Leaflet will have to rely on a development snapshot of Geofield, and on the 2.x version of the module, while right now the 1.x version is recommended.
I'd maybe like to see Geofield promoting first the 2.x branch as the recommended release (even in alpha) before we add this to Leaflet. If not, when people enable both Geofield and Leaflet with the recommended releases, there will be a problem...
Comment #9
balagan commentedOk, who need support for geofield dev, will find this patch here. By the way, I think geofield dev now stores data in wkb, so I hope they roll out a new recommended release soon and users can benefit from it.
Comment #10
pvhee commentedGreat, as soon as they roll out a new recommended release we should update Leaflet as well. Keeping this issue open to track.
Comment #11
aaronbaumansee also #2093273: [meta] Create a 2.x branch corresponding to geofield-2.x branch
to hopefully resolve future problems like this.
Comment #12
rdeboerFixed with this commit: http://drupalcode.org/project/leaflet.git/blobdiff/b13e96466886c002045f1...
Leaflet is now compatible with both versions 7.x-1.x and 7.x-2.x of Geofield.
Duplicate of #1996056: Compatibility with Geofield 7.x-2.0 and later
Rik
Comment #13
aaronbaumanAwesome, thanks Rik