Hi,

If you create a node with a non-empty address then you edit the same node and remove the address, the geocoded data remains the same and the map still shows up.
I understand that geocoder ignores empty addresses but it may also delete old informations.

Regards.

PS : take care of the hook_field_is_empty implementation on addressfields which is being improved #1263316: Configurable non-empty value conditions

Comments

duaelfr’s picture

Status: Active » Needs review
StatusFileSize
new508 bytes

Here is a patch.

phayes’s picture

Status: Needs review » Fixed

Thanks! Fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jackbravo’s picture

This fix introduces a bug described here:

https://drupal.org/node/1992762

I would like to re open this, but I think the correct approach is to open a new one right? So I guess the right way forward is fixing that new issue right?

the666bbq’s picture

can't you just return an empty array on

// If no valid source values were passed.
if (empty($source_field_values)) {

like you do on

if (empty($geometries)) {

this invokes deleting saved data, rather than returning false which invokes 'do nothing'.

ergophobe’s picture

Issue summary: View changes

jackbravo's patch in #1992762: Programmatic Update of an entity empties a geofield due to regression introduced/exposed in issue #1777934 solves this problem for me and does not introduce the other issue when editing a node and saving with unchanged location data (see the referenced issue)

johnhanley’s picture

I'm not sure if this patch made it into dev (I'm using 7.x-1.2), but the implementing the above hook in a custom module fixed erroneous geo points for addresses with only a default country (which results in points placed in the middle of the country.)