Closed (fixed)
Project:
Geofield
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
13 Aug 2012 at 17:54 UTC
Updated:
18 Sep 2012 at 06:41 UTC
Jump to comment: Most recent file
Two things in openlayers_geofield_widget_element_validate():
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | geofield-geom_missing-1728420-12.patch | 1.35 KB | netbek |
| #10 | geofield-geom_missing-1728420-10.patch | 1.36 KB | netbek |
| #1 | geofield-openlayers_geofield_widget_element_validate-1728420.patch | 2.69 KB | netbek |
Comments
Comment #1
netbek commentedPatch attached. Proceed with caution because it needs further testing. Also, I'm not sure if it's entirely correct (doesn't use openlayers_geofield_override_element_delta()), and if the transition from WKT to WKB storage could be handled better.
Tested with:
* fields: multiple value addressfield and taxonomy reference
* multi-value input handling: Match Multiples
* storage: "Each simple feature as a separate field" (single), and as collection
I've also changed geofield_field_presave() because in my setup it's called twice when saving a node. This resulted in NULL values saved to db due to WKB loaded as WKT in geofield_compute_values() because no 'input_format' in second call.
Comment #2
netbek commentedMarking for review because others are also trying to geocode a point with the OL widget and failing with the latest devs of geofield, geocoder, geophp, openlayers. See #1651200-5: Fatal error: Call to undefined method geoPHP::geosInstalled() onwards. Patch in #1 solves the issue for me, but I'd appreciate if others could try it out.
Comment #3
phayes commentedThis is generally looking good, but can you explain, in the patch, why you are remove
openlayers_geofield_override_element_deltaComment #4
netbek commentedI'm not sure what its purpose is now because I'm not assigning values using
geofield_element_validate($element, $form_state). Looking at the repo history http://drupalcode.org/project/geofield.git/blobdiff/22bc5ae452da1784d558... I don't think changes to #parents and #array_parents as done inopenlayers_geofield_override_element_delta()was needed ingeofield_element_validate(). Maybe it was useful later down the chain when saving or previewing a node in an earlier version of geofield. [edit]Here's a test with 2 points with the latest dev + patch:
Here's the abbreviated output from
print_r()to see what's done inopenlayers_geofield_override_element_delta(). Called 3 times - once at the top and once for each of 2 deltas:Comment #5
dpw commentedI was getting the error:
Only NDR (little endian) SKB format is supported at the moment in WKB->getGeometry() line (line 48 of geoPHP/lib/adapters/WKB.class.php)
and Patch #1 seems to have resolved this issue. Still testing...
I was using Geofield 1.1 and upgraded to latest 2.x dev when the error started...
using latest OpenLayers dev.
Comment #6
netbek commentedRegarding the
Exception: Only NDR (little endian) SKB formaterror and the patch in #1, some results after applying the patch to latest dev geofield, and using latest dev geocoder, geophp:Success:
#1757374-6: Widget errors with addressfield / geofield / openLayers
Failure:
#1651200-16: Fatal error: Call to undefined method geoPHP::geosInstalled()
Comment #7
phayes commentedComment #8
phayes commentedThis particular WKB bug is now fixed, but we're still getting problems with delta and single vs collection handling.
Comment #9
phayes commentedOptimistically marking this as fixed. Please feel free to re-open if you have issues.
Comment #10
netbek commentedAlmost there. It now works when saving a node, but not when previewing a node. The infamous
Exception: Only NDR (little endian) SKB formaterror is thrown after hitting the Preview button._geofield_openlayers_formatterandopenlayers_field_widget_formlook for ageomindex, but there is none.Here's an abbreviate backtrace from
_geofield_openlayers_formatter:Patch attached. I'm not sure if assuming the values are in WKT when
geomis absent is necessarily the best approach, but it works for me as a temporary measure -- perhaps until the format of values passed to the various functions is declared or auto-detected.Tested with:
* storage: single; collection
* multi-value input handling: match multiples; multiple to single
Comment #11
phayes commentedThe latest version of geoPHP (including the dev version of the geophp module) now has automatic format detection, so we can omit the second 'wkb' / 'wkt' argument being passed to geoPHP::load() . just
geoPHP::load($value)should do the trickComment #12
netbek commentedNice. Patch modified then and tested with the latest dev geophp and geofield.
Edit: I took out the 'wkt'. If you feel the 'wkb' should go to, go ahead.
Comment #13
phayes commentedCommitted!
I removed the 'wkb' stuff. I really want to get geoPHP format detection in such a kickass state that we can feel like we can just throw values at it and it will read it correctly.
Comment #14
netbek commentedAgreed. I was hesitant to try the latest dev geophp after the last minor git hiccup, so I didn't see it earlier. I was hoping someone would add auto-detect because it solves many potential headaches.