This causes an empty map to be rendered (through OpenLayers) since the field is not empty, even though all its values are NULL.
When no geometries are returned, the field gets a LANGUAGE_NONE array with one value, NULL. Instead, the field should be an empty array in order for the field data to be deleted.
Attached is a patch to geocoder_field_attach_presave() in geocoder.widget.inc that solves this. I have had some successful testing, but I am not well versed with the entire widget. Is there a better way to do this? Does my method cause problems for other uses of the Geocoder widget?
Cheers,
Henry
Comment | File | Size | Author |
---|---|---|---|
#5 | geocoder-widget-empty-field-1.2.diff | 699 bytes | SeeSchloss |
geocoder_widget_empty_field.patch | 1.15 KB | henryblyth | |
Comments
Comment #1
henryblyth CreditAttribution: henryblyth commented#1588840: Geofield does not remove field_data record when all values are NULL using "Geocode from another field" contains some extra information regarding my mapping setup that brought this issue to my attention.
Comment #2
phayes CreditAttribution: phayes commentedCommitted and fixed. Thank you!
Comment #4
tomrishworth CreditAttribution: tomrishworth commentedI'm experiencing this issue, using the 7.x-1.2 version, which has the above patch included.
So I have a field called 'Address for Map' which geocoder uses. I'll add an address, and it'll geocode it fine, and display it on map. If I go back and delete the content in 'Address for Map' and save the node, the map will still display, showing the old point.
Comment #5
SeeSchloss CreditAttribution: SeeSchloss commentedReopening the issue since as tomnz said, the issue seems to exist in 1.2.
I didn't find a trace of this issue's patch in 1.2 code, here's a simple patch that seems to work for 1.2:
Comment #6
acCan confirm this patch solves the issue of not removing previously geocoded points.
Comment #7
Simon Georges CreditAttribution: Simon Georges commentedThis has been fixed since by #1777934: Delete geo data when address becomes empty.
Comment #8
Simon Georges CreditAttribution: Simon Georges commentedComment #9
Simon Georges CreditAttribution: Simon Georges commented