Google geocoding API ColdFusion

coldfusion geocodeOkay, that title was a mouthful, but I wanted to accurately describe how decided to Geocode thousands of locations for a client of mine.

Google, awesome as they are, have offered a ridiculously simple API to consume:


But, they naturally have rate limits, and even if they didn't, I'd feel more comfortable using their API responsibly. It is completely free after all.

So, I decided to write a ColdFusion script which does the following:

  1. Pulls a single location record from a database
  2. Sends the address from the record to the Google API
  3. If the API returns a result, store it in the database
  4. Otherwise, indicate that geocoding failed, so we don't attempt to geocode this record again.

Since we're only doing one record at a time, we'll have to set this up to run automatically at a specified interval. This is where the JavaScript part comes in.

I could have setup a cron job without much effort, but knowing me, I'd forget to remove it once geocoding is complete. So, I decided to open up my web browsers console, and drop in the following:

setInterval(function {
url: ' ',
success: function(data) {
console.log(data); }, 35000);

The 35 second interval is enough to comply with Google's 2, 500 query/day limit. The ColdFusion script follows below:

SELECT id, address
FROM locations

You might also like
Creating google maps with API V3
Creating google maps with API V3
Google Maps Geocoding Process for SugarCRM
Google Maps Geocoding Process for SugarCRM
google map api v3 codeigniter 01
google map api v3 codeigniter 01

Doyle Park...just up the street from my

by bikeriderdude

Office on Sonoma Avenue (towards Farmer's Lane).



O'Reilly Media Google Maps Hacks
Book (O'Reilly Media)
  • Used Book in Good Condition

Missing in Alaska without a trace  — Anchorage Daily News

eBooks (No Starch Press)
Wrox Professional Android 2 Application Development
Book (Wrox)
Garmin Garmin nuvi 880 4.3-Inch Widescreen Bluetooth Portable GPS Navigator
GPS or Navigation System (Garmin)
Related Posts