Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Answer:</p> <ol> <li>Download the CPAN <code>Geo::Coder::Google</code> object.</li> <li>Navigate your way to the V3.pm object.</li> <li>Drop this module into the code.</li> </ol> <p><code>sub reverseGeocode {my $self = shift;</code></p> <pre><code>my %param; if (@_ % 2 == 0) { %param = @_; } else { $param{location} = shift; } my $location = $param{location} or Carp::croak("Usage: reverseGeocode(location =&gt; \$location)"); if (Encode::is_utf8($location)) { $location = Encode::encode_utf8($location); } my $uri = URI-&gt;new("http://$self-&gt;{host}/maps/api/geocode/json"); my %query_parameters = (latlng =&gt; $location); $query_parameters{language} = $self-&gt;{language} if defined $self-&gt;{language}; $query_parameters{region} = $self-&gt;{region} if defined $self-&gt;{region}; $query_parameters{oe} = $self-&gt;{oe}; $query_parameters{sensor} = $self-&gt;{sensor} ? 'true' : 'false'; $uri-&gt;query_form(%query_parameters); my $url = $uri-&gt;as_string; if ($self-&gt;{client} and $self-&gt;{key}) { $query_parameters{client} = $self-&gt;{client}; $uri-&gt;query_form(%query_parameters); my $signature = $self-&gt;make_signature($uri); # signature must be last parameter in query string or you get 403's $url = $uri-&gt;as_string; $url .= '&amp;signature='.$signature if $signature; } </code></pre> <p>Then just use it like this:</p> <pre><code> my $location = $geocoder-&gt;reverseGeocode(location =&gt; '40.7837366863403,-73.9882784482727'); </code></pre> <p>Then you can access returning object like so:</p> <pre><code> print $location-&gt;{formatted_address}; </code></pre> <p>To see the detailed parts of the address see the following link as a guide: <a href="https://developers.google.com/maps/documentation/geocoding/" rel="nofollow">https://developers.google.com/maps/documentation/geocoding/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload