Closed (fixed)
Project:
Location
Version:
6.x-3.x-dev
Component:
Data update
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
13 Jul 2008 at 21:54 UTC
Updated:
25 Apr 2011 at 14:37 UTC
Does anyone know of a method to geocode the latitude and longitudes of a number of locations stored with just address data. I manually uploaded the addresses into the location and location_instance tables, but the only way I've determined to set the latitude/longitude is to edit the node the location is stored in and save a new revision.
Comments
Comment #1
groovypower commentedI am closing this out as there does not seem to be a need for this and I hacked together a solution for myself. Also, from the looks of Google's terms of use, any quick solution would probably have your API key disabled.
Comment #2
bdragon commentedI've always just used http://www.batchgeocode.com/...
Comment #3
giorgio79 commentedWhere in Google's terms have you seen they prohibit bulk geocoding?
In fact they are encouraging you to bulk geocode with tutorials and such on their pages....
Also, I have not ever heard of someone having a disabled API key, just limited to how much, 100 000 geocodings per day?
Comment #4
nicholasthompsonIf its at all relevant, I used this code for a V5 install where I wanted to update some locations. The query does a check to confirm the location DOES have an associated node and that the location IS 0 (zero)...
It then loads the node, wipes the long and lat values, submits and saves.
On my VPS this did about 3,000 nodes in about 10 minutes.
I believe Google restricts each key to either 15,000 or 50,000 a day - I cant remember which off the top of my head.
Comment #5
yesct commentedI'll mark this as fixed, as it seems to answer the original posters question.
Also, I'm tagging it geo-coding.
And it might be related to
#132541: refactor google geocoding
Comment #6
yesct commentedpopps. forgot to change status.
Comment #7
yesct commentedI just noticed in my latest 6.x dev version, under the location settings, there is an option for:
Enable JIT geocoding
If you are going to be importing locations in bulk directly into the database, you may wish to enable JIT geocoding and load the locations with source set to 4 (LOCATION_LATLON_JIT_GEOCODING). The system will automatically geocode locations as they are loaded.
That seems related to this issue.
Comment #8
yesct commentedmarked #406048: Option to geocode all locations that lack lat/long as a duplicate of this issue
Comment #10
jacksbin commentedGoogle has a limitation of 15000 geocodes per day (per IP). If you need to geocode a very large number of addresses you could use http://www.bulkgeocoder.com.
Comment #11
BenK commentedSubscribing
Comment #12
shark commentedYou can also do this manually using the Location API. In the following code, I had a bunch of 'school' nodes with addresses but not lat/lon, so I get the lat/lon, set it, and save the node.
I saved that code as bulk_geocode.php in the drupal/ directory and ran drush php-script bulk_geocode.php.