Class GoogleGeocoder

Description

This class accepts a street address and attempts to return lat/long coordinates using the Google Maps API.

  • author: Richard Sharp
  • version: 1.0
  • copyright: 2007
Variable Summary
string $Address
string $City
string $Country
string $Key
string $LastRequest
string $LastResponse
string $State
string $Zip
Method Summary
void GoogleGeocoder (string $Key)
mixed GeoCode ()
Variables
string $Address = "" (line 22)

Sets the street address to geocode. If the address is not broken down into street, city, state, etc, put the entire address in this field.

string $City = "" (line 28)

Sets the city to geocode.

string $Country = "US" (line 40)

Sets the country to geocode.

string $Key = "" (line 16)

Sets the API Key issued by Google.

string $LastRequest = "" (line 52)

Gets the raw request sent to Google.

string $LastResponse (line 58)

Gets the raw response received from Google.

string $State = "" (line 34)

Sets the state to geocode.

string $Zip = "" (line 46)

Sets the zip code to geocode.

Methods
Constructor GoogleGeocoder (line 67)

Constructor for the class.

void GoogleGeocoder (string $Key)
  • string $Key: The Google API key.
GeoCode (line 76)

Submits the address to Google and processes the response.

  • return: On success, returns an array containing two elements: Latitude and Longitude. Returns false on failure.
mixed GeoCode ()