This is actually for the 7.x Treehouseagency branch, but since it's not officially released, putting it here in 6.x.

Steps to reproduce:
Create a node with addressfield, geofield, and geocode.
Set geofield to take address field as input.
Enter in a proper address in address field and save the node. Geofield contains geo coordinates.
Edit the node and include a bogus address.
Geofield still contains old coordinates.

Ideally, a message would be displayed to the user as well.

Comments

nagiek’s picture

Title: Geocode doesn't clear Geofield if it receives a malformed address » Geocoder doesn't clear Geofield if it receives a malformed address
Project: Geocode »
Version: 6.x-1.x-dev »

Transferring project. Love that it's on d.o now.

nagiek’s picture

Project: » Geocoder
Version: » 7.x-1.x-dev

Oops I think this is the correct project.

michaelfavia’s picture

Desired outcome i assume is that it would wipe the geocoded result if it fails on the previous request?

michaelfavia’s picture

Status: Active » Closed (works as designed)

I checked into this for you and geocoder does indeed unset the geofield when it doesnt get a valid result from google. You can check this by setting the "other field" as body and putting in nonsense values like "tkktktktkt" youll notice previous geofield points are removed.

Unfortunately, or fortunately, google tries REALLY hard to get you a point:

http://maps.googleapis.com/maps/api/geocode/xml?address=burple!&sensor=f...

"Burple!" for example is geocoded into a city called "purple" in the phillipines.

Marking as works as intended unless you have a suggestion for improvement beyond this which im all ears for ;)

nagiek’s picture

Status: Closed (works as designed) » Active

I think so, though if it does that then we're getting into automatic data deletion. Still, the geofield input value is clearly "geocoded from another field", so if the address is no longer valid it doesn't make sense to have an outdated geofield.

In either case, I think a warning message should be displayed to the user, to let them know.

nagiek’s picture

Status: Active » Closed (works as designed)

Ok thanks.

the666bbq’s picture

Status: Closed (works as designed) » Active

I'm having the same problem however : clearing or malforming the referenced addressfield (multitext/textarea) does not clear the geofield in my node. After updating is has a new revision with the previous valid marker(s).
I could clear the geofield by changing the widget from 'geocode other field' to 'long/lat' for instance and emptying the previous location there.

What is the best way to clear a location (changing widgets isn't ;-) ?

candelas’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.25 KB

Hello

I was having the same problem. Steps to reproduce:

  • Create a node with a geofield widget with a good address.
  • Edit it and put a wrong address
  • Save
  • The map will not change and not error message will be given.

I include a patch that will clear the geocoder field and set a message for the user.

candelas’s picture

StatusFileSize
new1.44 KB

Better patch. It was not working well with new nodes. The problem was that when the field was equal it will return FALSE and when it had an error too.

pol’s picture

Status: Needs review » Closed (outdated)