Reviewed & tested by the community
Project:
Geo
Version:
6.x-1.x-dev
Component:
Geo Field module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Dec 2009 at 01:26 UTC
Updated:
14 Mar 2013 at 10:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
phayes commentedAlright i've figured it out.. You need to pass it as wkt.
Comment #2
phayes commentedRe-opening. This breaks any geo field:
This is because when loaded, geofield[0]['geo'] contains wkb, but when saving, it expects it in wkt.
Comment #3
phayes commentedAttached is a patch that is most of the way there.
I've added an extra function in the api: geo_detect, which can successfully detect between all currently supported formats (wkb, wkt, and array).
We now detect the format before saving the field, and make sure we save the field in WKB. There is an additional bug that I found when creating this patch: the wkb that is selected from the database is not acceptable for insertion into the database. I've created a temporary work-around that converts to wkt and back again to get the wkb to behave properly.
Comment #4
gagarine commentedI try this patch with success. You think is better to commit and open a new issue for the problem with the WKB format from database?
I'm for a commit because this bug cause a tonne of problems with others modules like rules.
Comment #5
gagarine commentedComment #6
gagarine commentedJust a small error. See the patch.
Note: you can NOT use this patch directly, first patch with #3
Comment #7
gagarine commented#666544: Data Loss on Node Save When No Permissions marked as duplicate
Ok I think we can pass this issue to "critical", people without permission on the field can erase content...
Comment #8
solipsist commentedTested and appears to fix the problem.
A simple piece of PHP such as this will trigger the bug:
Comment #9
gagarine commentedYou review the patch #6 with #3?
Comment #10
solipsist commentedI applied both patches (#3 and #6 in that order) and it seems to fix the problem.
Comment #11
gagarine commentedThanks! I use the both patch in production for almost 2 months without problem in different context.
Marked as reviewed. We can certainly have a cleaner solution... but this one seem to work.
Comment #12
strk commentedThe patch doesn't apply cleanly against CVS HEAD.
Is it still needed there ?
Comment #13
gagarine commented@strk I don't know..
Try
if you don't lose any informations... it's nice we can close the bug.
Comment #14
ahtih commentedApparently the patch is still needed in CVS HEAD, since node_load()+node_save() sequence still clobbers all geo fields in node.
Comment #15
ahtih commentedHere is an alternative (simpler) patch solving the same node_load()+node_save() problem. It is against current CVS HEAD. As opposed to the patch in #3, it does not try to detect the format of 'geo' attribute, but instead relies on the fact that geo_field('load', ...) puts a 'wkb' attribute in field item in addition to the usual 'geo' attribute. I'm not sure which of the patches is better, I'm using this one, but your mileage may vary.
Comment #16
KhaledBlah commentedthe patch in #3 and #6 does solve the node_load() + node_save() problem. However, in conjunction with the rules module (see: #574894: Rules triger "After updating existing content" erase Geo field) it does not work. While the saved value's is a WKT syntactically the floating point numbers are messed up. I am trying to understand the problem but I'd grateful for any hints.