If an address is entered and the latitude/longitude are cleared or the map marker is removed, we should attempt to geocode again. This patch does that, and also updates the instructions to reflect that.

Comments

scottgifford’s picture

This patch also causes geocoded locations to be shown on the map, which we found useful for verifying the geocoding was correct.

scottgifford’s picture

Status: Active » Needs review

Changed status to patch, since there is a patch attached.

nicholasthompson’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new5.77 KB

This is the same patch but I had to re-roll is as it looks like you did it to a different version to the current 3.x release...

Thanks for the patch, worked a treat on my setup.

nicholasthompson’s picture

Status: Reviewed & tested by the community » Needs work

Actually, I've been testing and this section that you added...

  // If we didn't get anything, no need to create LIDs. 
  if ($location['source'] == LOCATION_LATLON_UNDEFINED)
    return false;

... confuses me.

It breaks my site in that if I add a node with an address and this address is sent to Google for geocoding and google turns around and says "thats not a valid address" then these lines stop the record getting stored so I end up with a bunch of empty location fields.

scottgifford’s picture

Nicholas,

You are right, that doesn't work how I thought it would. Does it work for you if you just remove those lines?

I'll take a closer look at the code and see what I can figure out.

nicholasthompson’s picture

I believe so, I'm just retesting my dataset now... I foolishy made a script to go through and programaticaly submit each node to update the long-lat vals... I didn't expect to get all the locations wiped, so I'm reimporting the data again.

Its no big deal as its only a dev server. Learned my lesson though ;-)

scottgifford’s picture

Yes, it looks like your change to my patch was correct. Thanks, and sorry I wiped all your location data!

If everything works for you, could you roll a new patch and post it here? I have other changes to my location.module and it's time-consuming to untangle the ones that are just for this change. Thanks!

scottgifford’s picture

Status: Needs work » Needs review
StatusFileSize
new4.3 KB

Here is an updated patch against 5.x-3.0-test2 which addresses the problem reported by nicholasThompson.

bdragon’s picture

Status: Needs review » Fixed

Fixed in DRUPAL-5--3 and HEAD in a different way than the patch, and simplified some of the code at the same time.
http://drupal.org/cvs?commit=138981

Anonymous’s picture

Status: Fixed » Closed (fixed)

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