From XastirWiki
Jump to: navigation, search

Persisting position data between restarts of xastir

Experimental support for storage of station positions in a geospatially aware database. As of 9 February 2010 this experimental feature has not been tested much, and one user is experiencing crashes of Xastir when trying it. The feature is not under active development, and if you need this feature you might have to debug it yourself.

Note: Database support is experimental and any aspect may change at any time, including database structures. Scripts to create database tables for MySQL and Postgres/Postgis are in the scripts directory as db_gis_postgis.sql and db_gis_mysql.sql.

Warning: If you are connected to internet feeds for APRS data, it is possible to accumulate several million station records per day which could amount to around 300 MB of database records per day.

Postgres + Postgis:

  • Install Postgres. Include development packages (libpq).
  • Add Postgis spatial object support to Postgres.
  • Compile xastir with --with-postgis
  • After building xastir:
    • Create a database named xastir and a user with create rights on that database.
    • Edit db_gis_postgis.sql to set username and password for an xastir user with select access to the xastir database.
    • Default values are database=xastir, user=xastir_user
    • You may also need to set permissions in pg_hba.conf.
    • Run the queries in db_gis_postgis.sql.
    • Run xastir and add a SQL Database interface, start with the postgis defaults, add the username and password of the xastir user.

Other GIS applications (e.g. QGIS, Mapserver, GRASS) can access and display station data directly from the postgresql/postgis database.

You can configure the database interface to read station from the database on startup and to save stations as they are heard to the database. This provides persistence of station data between xastir sessions.

MySQL

  • Install MySQL. Include development packages (libmysqlclient).
  • Compile xastir with --with-mysql
  • After building xastir:
    • Create a database named xastir and a user with create rights on that database.
    • Edit db_gis_mysql.sql to set username and password for an xastir user with select access to the xastir database.
    • Default values are database=xastir, user=xastir_user
    • Run the queries in db_gis_mysql.sql (mysql xastir -p < db_gis_mysql.sql)
    • Run xastir and add a SQL Database interface, start with the MySQL defaults, add the username and password of the xastir user.

You can configure the database interface to read station from the database on startup and to save stations as they are heard to the database. This provides persistance of station data between xastir sessions.

Troubleshooting

If you have one or more spatial database interfaces set to activate on startup, and this produces a situation that won't let you start xastir normally [e.g. Station data with unusual characters could concevable cause xastir to segfault when retrieved from the database, and interactions between multiple databases that are both writing are reading station data at the same time from each other could potentally be unstable], you should be able to start xastir by editing the device configuration in ~/.xastir/config/xastir.cnf Look for DEVICEn_TYPE:14 lines (where n is the interface number, between 0 and 14, TYPE:14 devices are sql database interfaces), and edit the device to set both query on startup and on startup values to 0.

DEVICEn_QUERY_ON_STARTUP:0
DEVICEn_ONSTARTUP:0

If the cause is problematic data in your database, you may need to run a delete query to eliminate the problematic row(s).