Geo::Coder::XYZ - Provides a Geo-Coding functionality using https://geocode.xyz
Version 0.09
use Geo::Coder::XYZ; my $geo_coder = Geo::Coder::XYZ->new(); my $location = $geo_coder->geocode(location => '10 Downing St., London, UK');
Geo::Coder::XYZ provides an interface to geocode.xyz, a free Geo-Coding database covering many countries.
$geo_coder = Geo::Coder::XYZ->new(); my $ua = LWP::UserAgent->new(); $ua->env_proxy(1); $geo_coder = Geo::Coder::XYZ->new(ua => $ua);
$location = $geo_coder->geocode(location => $location); print 'Latitude: ', $location->{'latt'}, "\n"; print 'Longitude: ', $location->{'longt'}, "\n"; @locations = $geo_coder->geocode('Portland, USA'); diag 'There are Portlands in ', join (', ', map { $_->{'state'} } @locations);
Accessor method to get and set UserAgent object used internally. You can call env_proxy for example, to get the proxy information from environment variables:
$geo_coder->ua()->env_proxy(1);
You can also set your own User-Agent object:
use LWP::UserAgent::Throttled; $geo_coder->ua(LWP::UserAgent::Throttled->new());
$location = $geo_coder->reverse_geocode(latlng => '37.778907,-122.39732');
Similar to geocode except it expects a latitude/longitude parameter.
Nigel Horne <njh@bandsman.co.uk>
Based on Geo::Coder::GooglePlaces.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Lots of thanks to the folks at geocode.xyz.
Geo::Coder::GooglePlaces, HTML::GoogleMaps::V3
Copyright 2017-2018 Nigel Horne.
This program is released under the following licence: GPL2
To install Geo::Coder::XYZ, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Coder::XYZ
CPAN shell
perl -MCPAN -e shell install Geo::Coder::XYZ
For more information on module installation, please visit the detailed CPAN module installation guide.