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.05, this module makes use of the new context service, which replaces the original, and discontinued, geocode service.
Note: as of version 0.02, OAuth autorization has been replaced by the use of the new JSONP token.
METHODS
new
$geocoder = Geo::Coder::SimpleGeo->new(
token => 'Your SimpleGeo JSONP token',
# https => 1,
# debug => 1,
)
Creates a new geocoding object.
Accepts the following named arguments:
token
A JSONP token. (required)
A token can be obtained here: http://simplegeo.com/tokens/jsonp/
ua
A custom LWP::UserAgent object. (optional)
compress
Enable compression. (default: 1, unless debug is enabled)
https
Use https protocol for securing network traffic. (default: 0)
debug
Enable debugging. This prints the headers and content for requests and responses. (default: 0)
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:
{
address => {
geometry => {
coordinates => [ "-122.406049843623", "37.7724651361945" ],
type => "Point",
},
properties => {
address => "65 Decatur St",
city => "San Francisco",
country => "US",
county => "San Francisco",
distance => "0.01",
postcode => 94103,
province => "CA",
},
type => "Feature",
},
query => {
address => "41 Decatur St, San Francisco, California 94103",
latitude => "37.772555",
longitude => "-122.405978",
},
timestamp => "1309346653.669",
}
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
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:
GitHub Source Repository
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
http://rt.cpan.org/Public/Dist/Display.html?Name=Geo-Coder-SimpleGeo
Search CPAN
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>