Chapter 6 — Working with Existing Address Information 101
building a query — it looks for the query values, removes the + signs (which are spaces) and
prints the results, removing duplicate results in the process.
The script is very basic. To use it, just supply the address and/or city and country that you want
to look up. The more specific the information you provide the better; also, remember to use
suitable conventions (such as “ave” in place of “avenue”) where appropriate.
For example, to find Fifth Avenue in New York you might use the following:
$ find.pl “fifth avenue, New York, NY”
Lat: - Lng:
Alternatives:
Grand Army Plz, New York, NY 10021
5th Ave, New York, NY
Here Google Maps is suggesting the use of the numeric form of the avenue name and the
shorter form of avenue:
$ find.pl “5th Ave, New York, NY”
Lat: 40.765520 - Lng: -73.972100
Google is case sensitive when using this interface. Searching for “5th ave” returns only a list of
alternatives, but “5th Ave” returns the latitude and longitude.
You can also locate U.K. addresses:
$ find.pl “Sheep Street, Bicester, UK”
Lat: 51.898116 - Lng: -1.151409
Find U.S. Zip codes:
$ find.pl “90210”
Lat: 34.090107 - Lng: -118.406477
Find U.K. Postcodes:
$ find.pl “OX9 2ED”
Lat: 51.745956 - Lng: -0.979953
Finally, Google will also return most major towns and cities across the world:
$ find.pl “Ronda, Spain”
Lat: 36.740001 - Lng: -5.159999
$ find.pl “tokyo”
Lat: 35.669998 - Lng: 139.770004
The Google solution, unlike the geocoder.ussolution, is not really designed for large-
volume situations, but it can be an excellent way to look up information for a smaller map.
The only issue with “scraping” for information in this way is that the format of the data that is
extracted is not guaranteed. It is quite possible that the text extraction and regular expression
matching process fails to find the information that you want after such a change, and that
could render your software and application unworkable without redevelopment.