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.

Comments

yesct’s picture

Issue tags: +location importing

tagging.

juicytoo’s picture

Hi kasiawaka,

It might also belong here.

http://drupal.org/project/node_import

cheers
Ed

okday’s picture

subscribing

thanks

okday’s picture

Hi,

the module is not compatible with drupal 6.10 and more..

thanks

summit’s picture

Subscribing, +1 for Drupal 6 update!

greetings,
Martijn

acdtrp’s picture

I 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?

kasiawaka’s picture

StatusFileSize
new2.67 KB

I 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:

UPDATE location a, zipcodes b
SET a.latitude = b.latitude,
a.longitude = b.longitude
WHERE a.country = b.country
AND a.postal_code = b.zip

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

kasiawaka’s picture

Hi 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).

ankur’s picture

Category: feature » support
Status: Needs review » Closed (fixed)

This sounds like a support request that was resolved.