NAME

Geo::Coder::Mapquest - Geocode addresses with Mapquest (beta)

SYNOPSIS

use Geo::Coder::Mapquest;

my $geocoder = Geo::Coder::Mapquest->new(apikey => 'Your API Key');
my $location = $geocoder->geocode(
    location => 'Hollywood and Highland, Los Angeles, CA'
);

DESCRIPTION

The Geo::Coder::Mapquest module provides an interface to the Beta Mapquest Geocoding Web Service.

METHODS

new

$geocoder = Geo::Coder::Mapquest->new(apikey => 'Your API Key')

Creates a new geocoding object.

A valid developer 'apikey' is required. See "NOTES" on how to obtain one and set it up.

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 locations results.

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

{ }

If the location contains non-ASCII characters, ensure it is a Unicode- flagged string or consists of UTF-8 bytes.

ua

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

Accessor for the UserAgent object.

NOTES

The geocoding results are not production quality at this time. International queries produce no results and US addresses frequently only return results that are only accurate to the country-level.

An API key can be obtained here: http://developer.mapquest.com/Home/WhyJoin.

Note that Mapquest already url-encodes the key, so the geocoder constructor will prevent it from being doubly-encoded. Ensure you do not decode it yourself before passing it to the constructor.

After obtaining a key, you must enable the Blank Referers option for the account.

SEE ALSO

http://platform.beta.mapquest.com/geocoding/

Geo::Coder::Bing, Geo::Coder::Google, Geo::Coder::Yahoo

REQUESTS AND BUGS

Please report any bugs or feature requests to http://rt.cpan.org/Public/Bug/Report.html?Queue=Geo-Coder-Mapquest. 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::Mapquest

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright (C) 2009 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>