NAME

Geo::Coder::RandMcnally - Geocode addresses with Rand Mcnally Maps

SYNOPSIS

use Geo::Coder::RandMcnally;

my $geocoder = Geo::Coder::RandMcnally->new;
my $location = $geocoder->geocode(
    location => '9855 Woods Drive, Skokie, IL'
);

DESCRIPTION

The Geo::Coder::RandMcnally module provides an interface to the geocoding service of Rand Mcnally Maps through an unofficial REST API.

METHODS

new

$geocoder = Geo::Coder::RandMcnally->new();

Creates a new geocoding object.

Accepts an optional ua parameter for passing in a custom LWP::UserAgent object.

geocode

$location = $geocoder->geocode(location => $location)
@locations = $geocoder->geocode(location => $location)

In scalar context, this method returns the first location result; and in list context it returns all location results.

Each location result is a hashref; a typical example looks like:

{
  city       => "Skokie",
  country    => "USA",
  county     => "Cook County",
  lat        => "42.056628",
  lon        => "-87.761216",
  name       => "9855 Woods Dr, Skokie, 60077-1074, Cook County, IL, USA",
  postalCode => "60077-1074",
  precision  => 6,
  state      => "IL",
  street     => "9855 Woods Dr",
}

response

$response = $geocoder->response()

Returns an HTTP::Response object for the last submitted request. Can be used to determine the details of an error.

ua

$ua = $geocoder->ua()
$ua = $geocoder->ua($ua)

Accessor for the UserAgent object.

NOTES

International (non-US) queries do not appear to be supported by the service at this time.

SEE ALSO

http://maps.randmcnally.com/

REQUESTS AND BUGS

Please report any bugs or feature requests to http://rt.cpan.org/Public/Bug/Report.html?Queue=Geo-Coder-RandMcnally. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Geo::Coder::RandMcnally

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright (C) 2011 gray <gray at cpan.org>, all rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

gray, <gray at cpan.org>