Geocoding with PHP and the Google Maps API
After learning how to perform a request and to understand the results, we implement a PHP solution made up of three classes:
Point, which make using the Google geocoder very straightforward.
We finished the article by implementing a simple web-based interface to the geocoder, which allowed users to enter an address and retrieve the resulting locations.
While we didn't implement a caching solution in this article, you should always try to minimize the number of geocoding requests that your application performs by saving the responses for future use. This is done not only increase performance but to also not go over the quota allocated by Google.
- Google Maps Geocoder Documentation: http://code.google.com/apis/maps/documentation/services.html#Geocoding
- Google Maps API Reference: http://code.google.com/apis/maps/documentation/reference.html