Managed Hosting



Google Geocoder V3
Project Home Contact Project

Author: Monte Chan (All RIAForge projects by this author)
Last Updated: March 20, 2010 10:52 PM
Views: 27,986
Downloads: 3,030
Demo URL: http://www.rentvine.com/misc/geocoding.cfm
License: Apache License, Version 2


Function, googlegeocoder3, would return geocoding information of an address. It allows reverse lookup (i.e. passing in only the latitude and longitude).

Version 3 of Google Geocode does not require an API key. It also allows reverse lookup (i.e. looking up by the latitude and longitude).

Googlegeocoder3 accepts seven parameters. While all these seven parameters are set to optional, in order for you to get some meaningful results, either address or latlgn (not both at the same time) MUST be specified.
1) address -- the actual address that you want to look up.
2) latlng -- the latitude and longitude that you want to look up. Be sure to not leave any spaces between the latitude and the longitude (i.e. 40.714224,-73.961452). You would use this when you want to do a reverse lookup.
3) language -- by the default, the language in which the results come back is the native language of the domain from which the request is sent wherever possible. For a list of language codes supported by Google, please go to http://spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1 and look under v3. Please note that this list gets updated often so this list may not be exhaustive.
4) bounds -- the bounding box of the viewport within which to bias geocode results more prominently.
5) region -- The region code (ccTLD argument). For example, a geocode for "Toledo" would return the results belong Toledo, OH in the United States because the United States is set to be the defult domain. When you specify the region code (i.e. es), it would return the results belong to Toledo, Spain.
6) sensor -- This is to indicate whether the request comes from a device with a location sensor. The default is false.
7) ShowDetails -- This is for you to toggle on and off to show the detail information. The default is false. If it is set to false, you will receive the following fields.
-- Status
-- Result_Type
-- Formatted_Address
-- Latitude
-- Longitude
-- Location_Type
If it is set to true, you will receive the following additional fields.
-- Address_Type
-- Address_Long_Name
-- Address_Short_Name
-- Southwest_Lat
-- Southwest_Lng
-- Northeast_Lat
-- Northeast_Lng
For the most common use, you will probably set ShowDetails to false, which is the default.

Read the readme.txt and Instructions.txt for details of the cfc. Run test_geocode.cfm to see the two sample outputs.


ColdFusion MX 7