Geo::GeoNames::DB::SQLite - Perl module for handling GeoNames.org data stored in a SQLite database.
use Geo::GeoNames::DB::SQLite;
my $dbh = Geo::GeoNames::DB::SQLite->connect( "geoname.sqlite" );
my @records = $dbh->query( "Beijing" );
print join( "\n", @records ) . "\n";
Geo::GeoNames::DB::SQLite is a Perl module to store GeoNames.org records, which tries to balance the trade-offs between the memory cost of using a Perl hash of Geo::GeoNames::Record objects and the speed of using using a GeoNames.org data file.
Xiangrui Meng <mengxr@stanford.edu>
Copyright (C) 2010 by Xiangrui Meng
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
Constructor.
my $dbh = Geo::GeoNames::DB::SQLite->connect( $dbname );
Insert or replace GeoNames.org records. It accepts Geo::GeoNames::Record and Geo::GeoNames::File object(s) as input.
Always remember to commit changes by
$db->commit;
Select all records. (slow)
Select all the alternate names and corresponding geonameids.
Query function.
my @records = $dbh->query( $geonameid ); my @records = $dbh->query( $name1, $name2 );
To install Geo::GeoNames::Record, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::GeoNames::Record
CPAN shell
perl -MCPAN -e shell install Geo::GeoNames::Record
For more information on module installation, please visit the detailed CPAN module installation guide.