As anyone who's made maps, or map applications can tell you, geocoding is one of the most important, but difficult aspects. Taking an address, like "12 main st., Boston, ma" and turning it into a map coordinate is a very difficult and hardly ever perfect science.
First of all, the string needs to be parsed and turned into something the address lookup can understand. Is "st." the same as "street"? Is the word after the street, in this case, "Boston", the city? If so, how about: "12 main st., Suite 200, Boston, ma". "Suite 200" is not the city! A lot of clever and complicated rules need to be applied to figure out what the user is asking for. Most geocoders will accept a zipcode for city, state, which is usually a pretty accurate and easy thing for the user to enter.
Next, the address lookup tries to find the 'best match' for an address, so it may not really be what the user intended. For example, Google maps shows the above address somewhere between Charlestown and Somerville, not in Boston proper:
Did the user mean something else? Who knows? ;-)
Finally, there are licensing and usage issues with some lookups that come from proprietary sources. The google map api will not work for addresses in the UK or China, for this reason.
I've tried to address these shortcomings in MapTrot in a few ways. I've been looking into and trying to find another geocoding service that I can use to augment the google api. Yahoo is a good candidate as it's free, robust, worldwide, and easy to inegrate. The problem is that it does a miserable job in the two countries I need it most: the UK and China! It will find coordinates for most cities and towns, but usuaully fails on streets and addresses. I'm still looking for a better solution.
Even when the geocoder thinks it finds an address and returns map coordinates, the actual location of a street address (ie, a home or business) can easily be more than a block or two off! Since geocoders tend to know about streets and then try to figure out the addresses, they will usually hit a point on the correct street, but hardly ever right on the address.
Another way to address the difficulties in geocoding is to allow the user to pan/zoom in on a map and create locations by selecting points on the map. This is a new feature of MapTrot, that has just been added. Click anywhere on the map and a "New Address" dialog is presented to enter any other location information desired (like notes, a title, a url, etc.).
Labels: geocoding