2. What is geocoding? Geocoding is the process of finding associated geographic coordinates (often expressed as latitude and longitude) from other geographic data, such as street addresses, or zip codes (postal codes) See also: http://www.lokku.com/lpw06_geocoding/
4. The problem: many remote geocoders Geo::Coder::Google Geo::Coder::Yahoo Geo::Coder::Placefinder Geo::Coder::Mapquest Geo::Cloudmade Geo::Coder::Bing Geo::Coder::OSM Geo::Coder::SimpleGeo And more …
5. the small print registration, keys rate limits usage limits http://www.flickr.com/photos/mrwilleeumm
6. But different … quality query formats response formats concepts of precision version changes http://www.flickr.com/photos/goldberg
7. Geo::Coder::Many One interface Single precision definition Intelligent caching and failover Easily set picker and filter methods, with common use cases predefined http://www.flickr.com/photos/vermininc
8. And now for some code http://www.flickr.com/photos/vermininc use Geo::Coder::Locatorize; use Geo::Coder::WhereIzIt; use Geo::Coder::Many; use Geo::Coder::Many::Util qw( country_filter ); # Create the Geo::Coder::Many object # using a 'weighted round robin' # scheduling method my $options = { cache => $cache_object, scheduler_type => 'WRR', }; my $geocoder_many = Geo::Coder::Many->new( $options );
9. … continued http://www.flickr.com/photos/vermininc # Create and add a geocoder my $Locatorize = Geo::Coder::Locatorize->new( appid => 'mY_loCat0r1Ze_iD' ); my $Locatorize_options = { geocoder => $Locatorize, daily_limit => 2500, }; $geocoder_many->add_geocoder( $Locatorize_options ); # Create and add a second geocoder my $WhereIzIt = Geo::Coder::WhereIzIt->new( apikey => 'mY_WhERiz1t_kEy' ); my $WhereIzIt_options = { geocoder => $WhereIzIt, daily_limit => 4000, }; $geocoder_many->add_geocoder( $WhereIzIt_options ); # Use a filter callback from Geo::Coder::Many::Util # we only want results from the UK # fuck you London, Ontario! $geocoder_many->set_filter_callback(country_filter('United Kingdom')); # Use a built-in picker callback $geocoder_many->set_picker_callback('max_precision');