Repository navigation
Methods
apneadiving edited this page Feb 16, 2011
·
27 revisions
This method retrieves an Array of Hash of potential coordinates.
Each hash is made up: latitude, longitude and matched_adress retrieved by Google.
Here is an example:
Gmaps4rails.geocode("Caroline")
=> [
{:lat=>-9.9599095, :lng=>-150.2052861, :matched_address=>"Millennium Island, French Polynesia"},
{:lat=>44.72083, :lng=>-88.89139, :matched_address=>"Caroline, WI, USA"},
{:lat=>42.37833, :lng=>-76.29583, :matched_address=>"Caroline, NY 14817, USA"},
#many other results...
]
It could raise two kinds of exception:
-
GeocodeStatus Basically, Google can't find the address provided: raise Gmaps4rails::GeocodeStatus, "The adress you passed seems invalid, status was: #{parse["status"]}. Request was: #{request}"
-
GeocodeNetStatus No Http Success.
raise Gmaps4rails::GeocodeNetStatus, "The request sent to google was invalid (not http success): #{request}. Response was: #{resp}"
Could follow an array of objects or a single object.
It creates the json that would be passed to google, in accordance with the details you gave.