Read-only mirror of https://github.com/opendata-swiss/ckanext-geocat_ng — opendata.swiss. Issues & pull requests at the source.
  • Python 97.1%
  • Shell 2.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sabine Maennel 02e248a898
Merge pull request #2 from opendata-swiss/adapt-travis-build
change class name of plugin back to GeocatHarvester
2021-05-28 08:53:30 +02:00
bin adapt travis build to extension-name-change 2021-05-28 08:47:39 +02:00
ckanext adapt resource title for new geocat protocols 2021-05-26 09:13:29 +02:00
.coveragerc Initial commit 2015-10-27 14:55:19 +01:00
.gitignore Initial commit 2015-10-27 14:55:19 +01:00
.travis.yml Move travis-build.bash into bin/ to be consistent with other ckanexts 2021-05-18 15:58:48 +02:00
dev-requirements.txt Add tests for harvesting 2019-10-21 17:31:57 +02:00
LICENSE Initial commit 2015-10-27 14:55:19 +01:00
MANIFEST.in Initial commit 2015-10-27 14:55:19 +01:00
README.md adapt README file to new extension name 2021-05-28 08:41:08 +02:00
requirements.txt upgrade lxml to version 4.6.2 2021-03-15 15:07:07 +01:00
setup.cfg Update setup.cfg 2016-10-10 18:34:32 +02:00
setup.py change class name of plugin back to GeocatHarvester 2021-05-28 08:52:11 +02:00
test.ini rename ckanext-geocat as ckanext-geocat_ng and adapt setup.py and test.ini 2021-05-28 08:34:10 +02:00

Build Status

ckanext-geocat_ng

This extension harvests data from the Swiss CSW service geocat.ch to the Swiss open data portal opendata.swiss. The source format is ISO-19139_che (Swiss version of ISO-19139), the target format is DCAT-AP Switzerland.

Requirements

CKAN >= 2.4

Installation

To install ckanext-geocat:

  1. Activate your CKAN virtual environment, for example:

    . /usr/lib/ckan/default/bin/activate

  2. Install the ckanext-geocat Python package into your virtual environment:

    pip install ckanext-geocat

  3. Add geocat to the ckan.plugins setting in your CKAN config file (by default the config file is located at /etc/ckan/default/production.ini).

  4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:

    sudo service apache2 reload

Config Settings

To configure the harvester you have several harvester config options (in the harvester config JSON):

  • rights: The terms of use to be associated with all harvested datasets (default: NonCommercialNotAllowed-CommercialNotAllowed-ReferenceRequired)
  • cql: The CQL query to be used when requesting the CSW service (default: keyword = 'opendata.swiss')
  • user: The user to be used when importing the datasets (default: harvest)
  • organization: The organization to be associated to all harvested datasets (default: the organization, which owns the harvest source)
  • delete_missing_datasets: Boolean flag (true/false) to determine if this harvester should delete existing datasets that are no longer included in the harvest-source (default: false)

CLI Commands

This extension provides a number of CLI commands to query/debug the results of the CSW server.

To run an arbitrary query against the defined CSW server use the search command:

paster geocat search birds

This command takes an optional second parameter to specifiy the CSW url (defaults to http://www.geocat.ch/geonetwork/srv/eng/csw)

cql

To run an arbitrary CQL query against the defined CSW server use the cql command:

paster geocat cql "csw:AnyText like '%birds%'"
paster geocat cql "keyword = 'opendata.swiss'" https://www.geocat.ch/geonetwork/srv/eng/csw-ZH

This command takes an optional second parameter to specifiy the CSW url (defaults to http://www.geocat.ch/geonetwork/srv/eng/csw)

list

To list all IDs from the defined CSW server use the list command:

paster geocat list
paster geocat list "keyword = 'opendata.swiss'" 
paster geocat list "keyword = 'opendata.swiss'" https://www.geocat.ch/geonetwork/srv/eng/csw-ZH/

The first parameter is an arbitrary CQL query, if you omit it, the default query is used (keyword = 'opendata.swiss').

This command takes an optional second parameter to specifiy the CSW url (defaults to http://www.geocat.ch/geonetwork/srv/eng/csw)

dataset

To get a specific record (by ID), use the dataset command. Use the list command above to get an ID:

paster geocat dataset "1eac72b1-068d-4272-b011-d0010cc4bf676"
paster geocat dataset "8ae7eeb1-04d4-4c78-93e1-4225412db6a4" https://www.geocat.ch/geonetwork/srv/eng/csw-ZH/

This command takes an optional second parameter to specifiy the CSW url (defaults to http://www.geocat.ch/geonetwork/srv/eng/csw)

The output shows the returned XML from the CSW and the parsed dataset and distribution dictionaries.

Development Installation

To install ckanext-geocat for development, activate your CKAN virtualenv and do::

git clone https://github.com/ogdch/ckanext-geocat.git
cd ckanext-geocat
python setup.py develop
pip install -r dev-requirements.txt
pip install -r requirements.txt

Running the Checks

To run the code checks use:

flake8

Run the tests

To run the tests use the following command

nosetests