I screwed up and am trying to find a fix.

I set up CCK fields in a input view and then had somebody input about a 1,000 adresses. I had installed the GMap module but did not input a google api key! My bad!

Now I have a thousand addresses with their respective lat/long fields set to 0/0. I have now set the key and new entries have their lat/long field filled in nicely, automagically.

BUt how do I get the thousand entries with bad lat/longs updated to their correct values?

I saw a discussion obout automaticcaly regenerating the geoaddress if the lat/longs are wiped but not sure what they meant. Do I need to delete the zero entries in the lat long field? And what causes teh entry to be regenerated?

any help would be much appreciated.

thanks, Scott

Comments

rooby’s picture

Status: Active » Fixed

There is an option on the locations settings page (admin/settings/location) titled "Enable JIT geocoding".

If you check this then any locations that are loaded will be geocoded on load, IF they have their source set to LOCATION_LATLON_JIT_GEOCODING, which is equal to the number 4.

So you go in your database from the command line or phpmyadmin or whatever and set the source field to 4 for all entries in the location table that you want to geocode again.

Then you check the "Enable JIT geocoding" checkbox.
Then from now on every time a location is loaded it will be geocoded and saved back to the database (the source will also be changed when it is saved so the same locations won't be repeatedly re-geocoded.

So either you can let this happen as people view the nodes and the locations are loaded or you can run some php code that will make them all update at once.
You could just do a node_load() on all the nodes you want to update or without having to do any coding you could install the views_bulk_operations module and using the admin_content view that it provides select all your nodes and run the "Save post" operation. You might have to add that operation to the view as it might not be in the default setup.

rooby’s picture

Title: update 0.0 latitude/longitude fields » How to do mass re geocoding of nodes
Component: Data update » Documentation

Marked #1004710: Batch re-geocode of existing content? as a duplicate of this issue.

rooby’s picture

rooby’s picture

rooby’s picture

I have written a how to for this in the location module handbook - http://drupal.org/node/1041632

Status: Fixed » Closed (fixed)

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

ikeigenwijs’s picture

I needed this.
Thx for figuring this out.