I'm working on the project where client already had resource address information (street, city, country, postal code) in the spreadsheet file and wanted to import that data. The problem was that even after the data was imported to the Location (and other tables), the latitude and longitude were still empty.
I created an extension to the Location module that checks the Location table and automatically updates all rows that have latitude/longitude empty or set to "0.000000".
I'm not sure what is the best way to go forward with this feature/patch so I'm posting it here. I would love to hear comments about it and I can help to include it into the Location module (if you think it is needed).
The file location_bulk_update.zip should be unzipped and added to the modules/location/contrib/ and installed as any other module. To run the bulk latitude/longitude update, go to Site configuration -> Location -> Bulk update locations (admin/settings/location/bulk_update_location) and run the update.
For those who are also interested in the sql queries that allowed me to update the address information to Location (and related) tables, please take a look at the bulk_import_locations_queries.zip file. There is some explanation that describes the process.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | location_d6_bulk_update.zip | 2.67 KB | kasiawaka |
| bulk_import_locations_queries.zip | 2.19 KB | kasiawaka | |
| location_bulk_update.zip | 2.42 KB | kasiawaka |
Comments
Comment #1
yesct commentedtagging.
Comment #2
juicytoo commentedHi kasiawaka,
It might also belong here.
http://drupal.org/project/node_import
cheers
Ed
Comment #3
okday commentedsubscribing
thanks
Comment #4
okday commentedHi,
the module is not compatible with drupal 6.10 and more..
thanks
Comment #5
summit commentedSubscribing, +1 for Drupal 6 update!
greetings,
Martijn
Comment #6
acdtrp commentedI have an ubercart database of my client's addresses and I would like to import that as a default location for each user profile? Is this possible?
Comment #7
kasiawaka commentedI made an attempt to migrate this module to Drupal 6. Please test it (attached).
Also, I realized that this module may be outdated, seeing posts like http://drupal.org/node/662892 that allow "on the fly" updates of the latitude and longitude. I didn't test that solution but seems reasonable.
Therefore I am not planning to maintain it or port to Drupal 7, unless there will be a specific need that other scripts or patches don't fulfill.
Additionally, for those of us who already imported the locations (addresses) directly to the database using sql scripts and have populated zipcodes table using country files from Location module (database folder), you may want to use a sql script to populate proper latitude/longitude in the location table:
The Canadian postal codes are available here: http://www.freeformsolutions.ca/en/sites/default/files/downloads/zipcode... and more discussion here http://drupal.org/node/255995
Comment #8
kasiawaka commentedHi acdtrp,
Everything is possible ;) I usually do a direct database to database imports using SQL queries but you may also want to try the node_import module (http://drupal.org/project/node_import).
Comment #9
ankur commentedThis sounds like a support request that was resolved.