NAME
Geo::Coder::Googlev3 - Google Maps v3 Geocoding API
SYNOPSIS
use Geo::Coder::Googlev3;
my $geocoder = Geo::Coder::Googlev3->new;
my $location = $geocoder->geocode(location => 'Brandenburger Tor, Berlin');
DESCRIPTION
Use this module just like Geo::Coder::Google. Note that no apikey
is used in Google's v3 API, and the returned data structure differs.
Please check also http://code.google.com/intl/en/apis/maps/documentation/geocoding/ for more information about Google's Geocoding API and especially usage limits.
CONSTRUCTOR
- new
-
$geocoder = Geo::Coder::Googlev3->new; $geocoder = Geo::Coder::Googlev3->new(language => 'de', gl => 'es');
Creates a new geocoding object.
The Geo::Coder::Google's
oe
andapikey
parameters are not supported.
METHODS
- geocode
-
$location = $geocoder->geocode(location => $location);
Queries $location to Google Maps geocoding API and returns a hash reference.
The returned data structure looks like this:
{ "formatted_address" => "Brandenburger Tor, Pariser Platz 7, 10117 Berlin, Germany", "types" => [ "point_of_interest", "establishment" ], "address_components" => [ { "types" => [ "point_of_interest", "establishment" ], "short_name" => "Brandenburger Tor", "long_name" => "Brandenburger Tor" }, { "types" => [ "street_number" ], "short_name" => 7, "long_name" => 7 }, { "types" => [ "route" ], "short_name" => "Pariser Platz", "long_name" => "Pariser Platz" }, { "types" => [ "sublocality", "political" ], "short_name" => "Mitte", "long_name" => "Mitte" }, { "types" => [ "locality", "political" ], "short_name" => "Berlin", "long_name" => "Berlin" }, { "types" => [ "administrative_area_level_2", "political" ], "short_name" => "Berlin", "long_name" => "Berlin" }, { "types" => [ "administrative_area_level_1", "political" ], "short_name" => "Berlin", "long_name" => "Berlin" }, { "types" => [ "country", "political" ], "short_name" => "DE", "long_name" => "Germany" }, { "types" => [ "postal_code" ], "short_name" => 10117, "long_name" => 10117 } ], "geometry" => { "viewport" => { "southwest" => { "lat" => "52.5094785", "lng" => "13.3617711" }, "northeast" => { "lat" => "52.5230586", "lng" => "13.3937859" } }, "location" => { "lat" => "52.5162691", "lng" => "13.3777785" }, "location_type" => "APPROXIMATE" } };
AUTHOR
Slaven Rezic <srezic@cpan.org>
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.