Geo::GeoNames::DB::SQLite - Perl module for handling GeoNames.org data stored in a SQLite database.


Geo-GeoNames-Record documentation  | view source Contained in the Geo-GeoNames-Record distribution.

Index


NAME

Top

Geo::GeoNames::DB::SQLite - Perl module for handling GeoNames.org data stored in a SQLite database.

SYNOPSIS

Top

use Geo::GeoNames::DB::SQLite;

my $dbh = Geo::GeoNames::DB::SQLite->connect( "geoname.sqlite" );

my @records = $dbh->query( "Beijing" );

print join( "\n", @records ) . "\n";

DESCRIPTION

Top

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.

AUTHOR

Top

Xiangrui Meng <mengxr@stanford.edu>

COPYRIGHT

Top

METHODS

Top

connect()

Constructor.

    my $dbh = Geo::GeoNames::DB::SQLite->connect( $dbname );

insert()

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()

Select all records. (slow)

select_all_alternate_names()

Select all the alternate names and corresponding geonameids.

query()

Query function.

    my @records = $dbh->query( $geonameid );
    my @records = $dbh->query( $name1, $name2 );


Geo-GeoNames-Record documentation  | view source Contained in the Geo-GeoNames-Record distribution.