The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Astro::App::Satpass2::Geocode - Abstract geocoding wrapper class.

SYNOPSIS

 # Assuming Astro::App::Satpass2::Geocode::TomTom is a
 # subclass of this class,
 
 use Astro::App::Satpass2::Geocode::TomTom;
 use YAML;
 
 my $geocoder = Astro::App::Satpass2::Geocode::TomTom->new();
 print Dump( $geocoder->geocode(
     '1600 Pennsylvania Ave, Washington DC'
 ) );

DESCRIPTION

This class is an abstract wrapper for Astro::App::Satpass2 geocoding functionality. It may not be instantiated directly.

The purpose of the wrapper is to provide a consistent interface to the various Geo::Coder::* modules that provide geocoding services.

This class is a subclass of Astro::App::Satpass2::Copier.

METHODS

This class supports the following public methods in addition to those provided by its superclass:

new

 # Assuming Astro::App::Satpass2::Geocode::TomTom is a subclass
 # of this class,
 my $geocoder = Astro::App::Satpass2::Geocode::TomTom->new();

This static method instantiates a new geocoder object. It may not be called on this class.

This method takes arguments as name/value pairs. The supported arguments are geocoder and warner, which correspond to the same-named mutators.

geocode

 my @rslt = $geocoder->geocode(
     '1600 Pennsylvania Ave, Washington DC',
 );

This method must be overridden by any subclass. The subclass must not call $self->SUPER::geocode.

This method geocodes the given location, using the underlying geocoder object, and returns any results found. The result is an array of hash references, each hash representing one location. The hashes must have the following keys:

description

This is a description of the location. It is expected to be an address derived from the information returned by the geocoder.

latitude

This is the latitude of the location, in degrees, with south latitude negative.

longitude

This is the longitude of the location, in degrees, with west longitude negative.

geocoder

 $geocoder->geocoder(
     Geo::Coder::TomTom->new(),
 );
 my $gc = $geocoder->geocoder();

This method is an accessor/mutator to the underlying geocoder object.

If called with no arguments, it simply returns the underlying geocoder object.

If called with arguments, it sets the geocoder object. The argument must be either undef, a class name, or an object. If a class name, the class is instantiated. If undef, the default class is instantiated. In any event, the object must be a subclass of the default class.

GEOCODER_CLASS

 say 'Geocoder class is ', $geocoder->GEOCODER_CLASS;

This method must be overridden by any subclass. It may be implemented by use constant. The override must support being called as either a static or a normal method.

This method specifies the name of the underlying geocoder class.

GEOCODER_SITE

 say 'Geocoder site is ', $geocoder->GEOCODER_SITE;

This method must be overridden by any subclass. It may be implemented by use constant. The override must support being called as either a static or a normal method.

This method specifies the URL of the web site providing the service. It is intended to be used to probe the web site for availability.

SUPPORT

Support is by the author. Please file bug reports at http://rt.cpan.org, or in electronic mail to the author.

AUTHOR

Thomas R. Wyant, III wyant at cpan dot org

COPYRIGHT AND LICENSE

Copyright (C) 2011-2013 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.