#1948640: Add a checkbox to re-geocode on the save of a node / user / entity regardless of address change

Problem

When I click the "Re geocode" option in the location form while editing a node with some bad coordinates ("Source Geocoded (Exact)") and then save, nothing changes. However, if I delete the location and re-create it with identical values, I see the change I'm looking for.

It seems to me that this option just doesn't work.

Some history for my particular case: The site that I'm troubleshooting was recently running 7.x-3.2-beta2 which seems to have been generating coordinates that were slightly off (a fairly new behavior, it worked fine for most of its life). After updating to the latest 7.x-3.6, geocoding is getting me the correct coordinates now. I noticed the handy new 're geocode' option and tried to use it to fix my locations that were botched, but as mentioned - no dice. Only deleting and re-saving gets my coordinates back to normal.

Comments

hyperlinked’s picture

I'm assuming that you're using Google Maps as your geocoding service. What's happening is that when at attempt to re-geocode is made, it calls the location_latlon_exact() function, which in turn calls the service that you'll be using. If it's Google, the function it tries to call is google_geocode_location().

Unfortunately, that function no longer exists. In 3.5 it was located in /location/geocoding/google.inc. I devised my own workaround to return the latitude and longitude for these cases, but it probably goes counter to workings of the location module.

ndewhurst’s picture

Version: 7.x-3.6 » 7.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new2.69 KB

I encountered this issue as well. The "Re geocode" option introduced in https://www.drupal.org/node/1948640 does prevent location_save() from returning prematurely when no data has changed, but _location_geo_logic() performs its own, geocoding-specific check to see if any relevant data has changed, which is where this breaks down. This patch pulls the option into a simple param that now gets passed through to _location_geo_logic(). I tried to mimic the existing code style with respect to the $inhibit_geocode var that was already present. Note that $inhibit_geocode, which is not derived from a user selection, takes precedence over $force_geocode.

podarok’s picture

Status: Needs review » Fixed

Thanks a lot.
About to be pushed to latest dev

  • podarok committed 23eb965 on 7.x-3.x authored by ndewhurst
    Issue #2423769 by ndewhurst: Re geocode option on node form does not...

Status: Fixed » Closed (fixed)

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