• Save
Remote Geocoding
Upcoming SlideShare
Loading in...5
×
 

Remote Geocoding

on

  • 1,592 views

Ed Freyfogle's talk on remote geocoding at 2010 London Perl Workshop

Ed Freyfogle's talk on remote geocoding at 2010 London Perl Workshop

Statistics

Views

Total Views
1,592
Views on SlideShare
1,592
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Remote Geocoding Remote Geocoding Presentation Transcript

  • Remote Geocoding Ed Freyfogle London Perl Workshop, 4 Dec 2010
  • 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/
  • remote geocoding? http://www.flickr.com/photos/jennratonmort Magical internet elves try to answer your every geocoding whim across the miracle of HTTP
  • 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 …
  • the small print registration, keys rate limits usage limits http://www.flickr.com/photos/mrwilleeumm
  • But different … quality query formats response formats concepts of precision version changes http://www.flickr.com/photos/goldberg
  • 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
  • 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 );
  • … 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');
  • Let’s do this thing http://www.flickr.com/photos/vermininc my $result = $geocoder_many->geocode({ location => 'London NW1 5LS' }); if (defined $result) { print "Country: ", $result->{country}, "n"; print "Longitude: ", $result->{longitude}, "n"; print "Latitude: ", $result->{latitude}, "n"; print "Location: ", $result->{location}, "n"; print "Response code: ", $result->{response_code}, "n"; print "Address: ", $result->{address}, "n"; print "Precision: ", $result->{precision}, "n"; print "Geocoder: ", $result->{geocoder}, "n"; } else { print "Failed to geocode!n"; }
  • Possible response codes http://www.flickr.com/photos/vermininc 200 Success 210 Success (from cache) 401 Unable to find location 402 All geocoder limits reached
  • We need YOUR help
    • Add support for
      • Geo::Coder::GoogleV3 (underway as we speak)
      • Navteq, Cloudmade, TomTom
      • OpenSpace, country specific services?
    • More feedback
    • Move to github
    • More tests
    http://www.flickr.com/photos/revcyborg
  • You may also enjoy: Subscribing to geocoding@openstreetmap.org
  • Thanks! About Nestoria blog.nestoria.co.uk @nestoria About me @freyfogle We’re hiring: http://www.lokku.com/jobs/
  • Questions? http://www.flickr.com/photos/calavera/65098350/