Geo::Coder::Free - Provides a geocoding functionality using free databases of towns
Version 0.04
use Geo::Coder::Free; my $geocoder = Geo::Coder::Free->new(); my $location = $geocoder->geocode(location => 'Ramsgate, Kent, UK');
Geo::Coder::Free provides an interface to free databases.
Refer to the source URL for licencing information for these files cities.csv is from https://www.maxmind.com/en/free-world-cities-database admin1.db is from http://download.geonames.org/export/dump/admin1CodesASCII.txt admin2.db is from http://download.geonames.org/export/dump/admin2Codes.txt
See also http://download.geonames.org/export/dump/allCountries.zip
To significantly speed this up, gunzip cities.csv and run it through the db2sql script to create an SQLite file.
$geocoder = Geo::Coder::Free->new();
$location = $geocoder->geocode(location => $location); print 'Latitude: ', $location->{'latt'}, "\n"; print 'Longitude: ', $location->{'longt'}, "\n"; # TODO: # @locations = $geocoder->geocode('Portland, USA'); # diag 'There are Portlands in ', join (', ', map { $_->{'state'} } @locations);
$location = $geocoder->reverse_geocode(latlng => '37.778907,-122.39732');
To be done.
Does nothing, here for compatibility with other geocoders
Nigel Horne <njh@bandsman.co.uk>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Lots of lookups fail at the moment.
VWF, Maxmind and geonames.
Copyright 2017 Nigel Horne.
The program code is released under the following licence: GPL for personal use on a single computer. All other users (including Commercial, Charity, Educational, Government) must apply in writing for a licence for use from Nigel Horne at `<njh at nigelhorne.com>`.
To install Geo::Coder::Free, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Coder::Free
CPAN shell
perl -MCPAN -e shell install Geo::Coder::Free
For more information on module installation, please visit the detailed CPAN module installation guide.