I spend a few days searching on the web to get a good geocode database
and all my efforts proved to be in vain because there were a number of sites
that was providing me with a geocoding address database at an expensive cost
of $30-$100 . The cost was huge for me as this was only a supplement to my
full project . Luckily for me and for you while researching on this topics I came
across a number of viable options that could fit my need with a little bit of hack.
This were the three mapping giants Google Maps, Yahoo Maps & Bing Maps,
each of had their geocoding services that could be accessed via an API and this
exactly fitted my needs since I could store this data onto my database although
it is again the policies, you can still use it without a problem for small and big
projects within each of the MAP API's query limit .
Research on the Google, Yahoo and Bing Maps
So I started my testing the various Geocoding values returned by the various
API. I started out with Google Maps . Well the results of geocoding of the Google
Maps was highly accurate both for locations in and outside the US. The
Google Maps scaled well in terms of both accuracy as well as granularity of
results, in short it was giving out accurate geocoding results for even small towns .
The next test was on Bing Maps but sorry to say Bing Maps accuracy was best
till the city level, most of the Geocoding Address results was restricted to
only City Level results .The next and final research was done on Yahoo Maps
and happy to say Yahoo Maps Address Geocoding results was too accurate and
results between Yahoo and Google Maps could actually be mapped with each
Difference between Google Maps and Yahoo Maps ?
Each one has its own pros and cons and telling which ome is better is tough job .
However the key differences I have found out while comparing the two API's
- Graphically Google Maps has superior looks and gives a good
experience to the end user than the Yahoo Maps .
- Loading time of Yahoo Maps is less than that of Google Maps.
- Geocoding Rate of Google Maps is about 2000 queries a day/server .
- Geocoding Rate of Yahoo Maps is around 50, 000 queries a day .
- In Google Maps you can take the benefits of the Google Driving Directions
API but Yahoo doesn't provide such a facility to use its Driving Directions
in an API even though it does have one integrated in its Yahoo Maps website.
Creating the Geocode Address Database
With Yahoo providing me an Geocoding Address limit of 50, 000 queries and its
Geocoding addressing being accurate enough, I decided to use the Yahoo Maps API.
So lets start the coding part .The code for Yahoo Geocoding is as follows
To increase modularity & code reusability I would advice you to keep this page
separate . So How do I use this php code?
Create another php page in which you will be using this geocoding functions
using the php include page command .
1)Suppose you want to get the geocode address of a place say "CHICAGO" .
You can simply call the function as follows
Now for storing this result into the database you will have to capture the
result like this
$result=geoCodeYp("Chicago") ; // get each of the values as $latitude=$result['latitude']; // Get the Latitude $longitude=$result['longitude']; // Get the Longitude
You can store each of the results in database by retrieving
the remaining values as $result['valuename']; . The valuenames
are city, countrycode, state, street, house etc.
2) To geocode address of a point(latitude&longitude)
//Example Point with latitude 72.5632 & longitude 19.756
$latitude="72.5632"; $longitude="19.756"; // You have to include space between the latitude & longitude $point=$latitude." ".$longitude ; //call the geocode function geocode($point);
Time Required to setup Geocode Address Database
Suppose you have to want to geocode the address of around 5, 00, 000 address
Probably Tiger Line
The US Census has a free database called TigerLine. It's not always accurate. I've worked with it and field surveyed some glaring anomalies.
Now, I'm not sure MapQuest and MSN Maps are derived from TigerLine, but chances are they are. I recall researching some commercial geocoding services that purportedly enhance the accuracy of TigerLine.
If you email me your address, I could check the TigerLine for the bay area and see if the anomaly you noticed correlates.
If you're in the Castro or UpperMarket, I could help you with a very accurate map. My maps are based on the San Franciso GIS Department's CAD maps.