Geocoding with PHP and the Google Maps API
There are many applications for a geocoder and having access to a free, reliable and frequently updated geocoder is a huge help in web application development. Some examples of where a geocoder can be useful include:
- Plotting a user-submitted address on a map (such as a property owner listing their house on a real estate web site).
- Discovering the longitude and latitude so calculations can be performed (such as a finding other sets of coordinates within a given distance).
- Verifying addresses before shipping orders from your ecommerce store.
- Retrieving the properly formatted address string for the given location. This is very useful when you consider how inconsistent users can be when entering their address.
In this article we will develop several PHP 5 classes that will make it easy to query the geocoder and access the response.