pycsw administration is handled by the pycsw-admin.py utility. pycsw-admin.py is installed as part of the pycsw install process and should be available in your PATH.
Note
Run pycsw-admin.py -h to see all administration operations and parameters
pycsw supports the following databases:
Note
The easiest and fastest way to deploy pycsw is to use SQLite3 as the backend.
Note
PostgreSQL support includes support for PostGIS functions if enabled
Note
If PostGIS (1.x or 2.x) is activated before setting up the pycsw/PostgreSQL database, then native PostGIS geometries will be enabled.
To expose your geospatial metadata via pycsw, perform the following actions:
By default, pycsw supports the csw:Record information model.
Note
See Profile Plugins for information on enabling profiles
$ pycsw-admin.py -c setup_db -f default.cfg
This will create the necessary tables and values for the repository.
The database created is an OGC SFSQL compliant database, and can be used with any implementing software. For example, to use with OGR:
$ ogrinfo /path/to/records.db
INFO: Open of 'records.db'
using driver 'SQLite' successful.
1: records (Polygon)
$ ogrinfo -al /path/to/records.db
# lots of output
Note
If PostGIS is detected, the pycsw-admin.py script does not create the SFSQL tables as they are already in the database.
$ pycsw-admin.py -c load_records -f default.cfg -p /path/to/records
This will import all *.xml records from /path/to/records into the database specified in default.cfg (repository.database). Passing -r to the script will process /path/to/records recursively.
Note
Records can also be imported using CSW-T (see Transactions).
$ pycsw-admin.py -c export_records -f default.cfg -p /path/to/output_dir
This will write each record in the database specified in default.cfg (repository.database) to an XML document on disk, in directory /path/to/output_dir.
$ pycsw-admin.py -c optimize_db -f default.cfg
Note
This feature is relevant only for PostgreSQL and MySQL
pycsw supports publishing metadata from an existing repository. To enable this functionality, the default database mappings must be modified to represent the existing database columns mapping to the abstract core model (the default mappings are in pycsw/config.py:MD_CORE_MODEL).
To override the default settings:
[repository]
...
mappings=path/to/mappings.py
See the GeoNode Configuration and Open Data Catalog Configuration for further examples.
pycsw requires certain repository attributes and semantics to exist in any repository to operate as follows:
The following repository semantics exist if the attributes are specified:
Values of mappings can be derived from the following mechanisms:
Further information is provided in pycsw/config.py:MD_CORE_MODEL.