/stengl-cswconfig

Primary LanguagePythonOtherNOASSERTION

STENGL - CSW Configurator

GeoSolutions

CSW Configurator

https://badge.fury.io/py/cswconfig.svg?service=github Build Status Coverage Status
If you are facing one or more of the following:
  • TODO,
  • TODO,

Setup the virtual environment

To setup your project using a local python virtual environment, follow these instructions:

  1. Prepare the Environment
git clone https://github.com/geosolutions-it/stengl-cswconfig.git -b master
mkvirtualenv stengl

pip install --upgrade pip
pip install --upgrade setuptools

cd stengl-cswconfig
  1. Setup the Python Dependencies
GDAL_VERSION=`gdal-config --version` && \
  PYGDAL_VERSION="$(pip install pygdal==$GDAL_VERSION 2>&1 | grep -oP '(?<=: )(.*)(?=\))' | grep -oh $GDAL_VERSION\.[0-9])" && \
  pip install pygdal==$PYGDAL_VERSION

pip install -r requirements.txt --upgrade
pip install -e . --upgrade

Usage Examples

From the folder cd stengl-cswconfig

Edit the templates and settings cswconfig/settings/settings.ini

python cswconfig/convert.py -f /mnt/d/data/gisdata/data/good/vector/san_andres_y_providencia_administrative.shp --abstract "Description of the dataset" --datadate "2018-07-10 13:43:22" --timezone "Europe/Rome" --topic-category "boundaries" --temporalstart "2017-01-01" --temporalend "2020-01-01" --output FILE
python cswconfig/convert.py -f /mnt/d/data/gisdata/data/good/vector/san_andres_y_providencia_administrative.shp --abstract "Description of the dataset" --datadate "2018-07-10 13:43:22" --timezone "Europe/Rome" --topic-category "boundaries" --temporalstart "2017-01-01" --temporalend "2020-01-01" --output CSW

You may want to loop a directory content and create metadata for all the encountered files. Here's a sample script

for file in $(find /YOUR/PATH -name "*.shp")
do
  BASE=$(basename $file)

  python cswconfig/convert.py -f  $file --abstract "Description of the dataset" \
       --datadate "2018-07-10 13:43:22" --timezone "Europe/Rome" \
       --topic-category "boundaries" \
       --temporalstart "2017-01-01" --temporalend "2020-01-01" \
       --resource-name $BASE \
       --resource-url http://myserver/data/$BASE \
       --lineage-statement "Data from archive" \
       --inspire-keyword "Land cover" \
       --output FILE
done

Contributing

We love contributions, so please feel free to fix bugs, improve things, provide documentation. Just follow the guidelines and submit a PR.

Requirements

  • Python 2.7, 3.4, 3.5, 3.6
  • httplib2 >= 0.7.4
  • regex <= 2016.7.21
  • requests == 2.18.4
  • simplejson <= 3.13.2
  • pyproj >=1.9.5,<=1.9.5.1
  • OWSLib == 0.16.0
  • Shapely == 1.5.17
  • Jinja2 == 2.10
  • awesome-slugify == 1.6.5
  • python-dateutil == 2.7.3
  • pytz==2018.3
  • pygdal == (the version depends on your GDAL bin installed on the system)