NAME

Geo::Coder::SimpleGeo - Geocode addresses with the SimpleGeo API

SYNOPSIS

use Geo::Coder::SimpleGeo;

my $geocoder = Geo::Coder::SimpleGeo->new(
    token => 'Your SimpleGeo JSONP token'
);
my $location = $geocoder->geocode(
    location => '41 Decatur St, San Francisco, California 94103',
);

DESCRIPTION

The Geo::Coder::SimpleGeo module provides an interface to the geocoding functionality of the SimpleGeo API.

Note: as of version 0.02, OAuth autorization has been replaced the use of the new JSONP token.

METHODS

new

$geocoder = Geo::Coder::SimpleGeo->new(
    token => 'Your SimpleGeo JSONP token',
    # debug => 1,
)

Creates a new geocoding object.

A JSONP token can be obtained here: http://simplegeo.com/tokens/jsonp/.

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:

{
    geometry => {
        coordinates => [ "-122.406032", "37.772502" ],
        type        => "Point"
    },
    properties => {
        number    => 41,
        precision => "range",
        prenum    => "",
        score     => "0.805",
        street    => "Decatur St",
        zip       => 94103,
    },
    type => "Feature",
}

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.

SEE ALSO

http://simplegeo.com/docs/

Geo::Coder::Bing, Geo::Coder::Bing::Bulk, Geo::Coder::Google, Geo::Coder::Mapquest, Geo::Coder::Multimap, Geo::Coder::Navteq, Geo::Coder::OSM, Geo::Coder::PlaceFinder, Geo::Coder::TomTom, 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-SimpleGeo. 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::SimpleGeo

You can also look for information at:

COPYRIGHT AND LICENSE

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