The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

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

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

Xiangrui Meng <mengxr@stanford.edu>

COPYRIGHT

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.

METHODS

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