This algorithm provides a general-purpose geocoding functionality that is expanded on by other more specific geocoding algorithms (see Yahoo! Geocoder). It supports four types of geocoding: address, country, U.S. states and U.S. ZIP codes.
Pros & Cons
- Increase of code re-used with abstract classes that defines the common behaviors such as GUI layout, data handling, etc.
- Standard GUI layout gives a professional look to the application. Once user learns to use one geocoder, it will be same for using other geocoder plugins.
- Problems can arise if the inherited behaviors are not well defined, since a single change on the abstract class will cause changes on all sub-class.
Plugins that use this interface provide geographical coordinate information for the geomap application. Scientists can then visualize their data geographically.
This algorithm provides a common front-end behaviors algorithm for multiple geocoder plugins. It uses MVC (Model-View-Controller) idea to facilitate the in-dependency and code reused implementation.
- AbstractGeocoderFactory defined GUI layout, data validation and geocoder type selection. It contains a FamilyOfGeocoder member that refers to the related geocoder family (Generic, Yahoo, etc)
- GeocoderAlgorithm processes the geolocation look up using the given Geocoder. The first look up is through invoking geocodingFullForm. If the look up fails, the second look up will be performed through invoking geocodingAbbreviation. It also provides error handling which analyzes the look up failures and provides appropriate warning message to user. If the look up is successful, it will generate a CSV output file with two additional columns that hold latitude and longitude values.
- FamilyOfGeocoder contains four type of geocoders from the smae family. There are address, country, U.S. states and U.S. ZIP codes.
- It uses the common geocoder model that defined in edu.iu.scipolicy.model.geocode. It uses Geolocation, which represents geographical coordinate; and USZipCode, which contains uzip (the first 5 digit ZIP code); and postbox number (the last 4 digits number in 9-digits ZIP code).
- Each geocoder might hold its own model if needed
The usage is provided on each geocoder wiki page. For example, Yahoo! Geocoder.
The geocoding algorithm was authored, modified, integrated and documented by Chin Hua Kong. Many thanks to Chintan Tank first Generic Geocoder implementation that provide a based code to start from.