Atlas Database

This page explains the internals of the database and gives some hints for user defined actions on the data.

Database Format

The database is based upon wxsqlite which is a wrapper around the SQLite 3 database.

Example

Start the command line tool and show a list of available tables.

~/.maitreya-7.0> sqlite3 geonames.db
SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
admincodes atlas_ascii geonames
atlas countries geonames_aliases
atlas_alias featurecodes timezones
sqlite>

Import Location Data

The atlas database contains data from geonames.org. The source code distribution of Maitreya contains a perl script (src/atlas/geonames.pl) that can be used for user defined import or update of the atlas data.

Example steps

Filtering User Defined Entries

User defined changes of the database are marked internally. So a separate export of these records is possible.

The table "geonames" has a column "usercode" with values

Example

~/.maitreya-7.0> sqlite3 geonames.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select usercode,count(*) from geonames group by usercode;
0|123392
1|8
2|7
sqlite>

In the example 8 records were changed, 7 records were added.