Setting up the configuration file
Configuration file for PyWPS can be located on several places. There are global and local PyWPS configuration files. The locals will rewrite values stored in global files.
- File /etc/pywps.cfg (on Linux/Unix)
- File /usr/local/pywps-VERSION/etc/pywps.cfg, which means the file pywps.cfg in directory etc, located in PyWPS install location.
In this case a configuration file is used for a particular PyWPS instance. Each particular instance uses the file stored in PYWPS_CFG environment variable. This can be set either via web server configuration or with help of any wrapper script (See: Wrapper Script )
For example a local file can be located in: /usr/local/wps/pywps.cfg
File configuration sections:
Please note that the configuration file is case-sensitive
Several sections exist in the file.
The [wps] section contains the meta-information necessary to populate the WPS response, mainly information on who provides the service, restrictions, fees and a brief description on the service.
- contains general WPS settings, which are:
- Language encoding (utf-8, iso-8859-2, windows-1250, dots)
- Server title
- WPS version (1.0.0)
- Server abstract
- Possible fees
- Possible constraints
- WPS script address: http://foo/bar/wps.py
- Comma-separated list of keywords
- Default language (eng)
The [server] section defines the setting parameters of PyWPS, mainly path locations, URL translation and service limits.
- Maximal number of parallel running processes. If set to 0, then there is no limit.
- Maximal length of string input parameter (number of characters)
- Maximal input file size (raster or vector). The size can be determined as follows: 1GB, 5MB, 3kB, 1000b.
- Directory for temporary files (mostly temporary GRASS locations) (/tmp).
- Url where the outputs are stored.
- Path. where output files are stored.
- true/false - makes the logs for verbose
- This option has been depreciated in version 3.2. and LogLevel will be used to define log verbose
- new in version 3.2 use logLevel=DEBUG for complete debug information
- (since 3.0.1) File, where all logs from PyWPS are going to. If not set, default error.log from Web Server configuration is used. Sometimes, this can cause problem for the asynchronous calls.
- path to folder containing the processes. Default is pywps/processes. NOTE:You can set also PYWPS_PROCESSES environment variable with same result.
If using GRASS/GIS is it is advisable to configure the following section (if not it can be skipped) [grass]
- $PATH variable, e.g. /usr/lib/grass/bin
- $GRASS_ADDONS variable
- GRASS version
- Should be “text”
- Path to GRASS GIS_BASE directory (/usr/lib/grass)
- Path of GRASS Libs (/usr/lib/grass/lib)
- Full path to location directory (/home/foo/grassdata)
- NOTE: You do not have to setup this variable in the configuration file globally. You can use grassLocation attribute while calling the _ _init _ _ method of Process class, during process initialization. See section GRASS for more details.
Configuration file example:
A configuration could look more or less like this:
[wps] encoding=utf-8 title=PyWPS Server version=1.0.0 abstract=See http://pywps.wald.intevation.org and http://www.opengeospatial.org/standards/wps fees=None constraints=none serveraddress=http://localhost/cgi-bin/wps keywords=GRASS,GIS,WPS lang=eng [provider] providerName=Your Company Name individualName=Your Name positionName=Your Position role=Your role deliveryPoint=Street city=City postalCode=000 00 country=eu electronicMailAddressfirstname.lastname@example.org providerSite=http://foo.bar phoneVoice=False phoneFacsimile=False administrativeArea=False [server] maxoperations=3 maxinputparamlength=1024 maxfilesize=3mb tempPath=/tmp processesPath= outputUrl=http://localhost/wps/wpsoutputs outputPath=/var/www/wps/wpsoutputs debug=true logFile=/var/log/pywps.log [grass] path=/usr/lib/grass/bin/:/usr/lib/grass/scripts/ addonPath= version=6.2.1 gui=text gisbase=/usr/lib/grass/ ldLibraryPath=/usr/lib/grass/lib gisdbase=/home/foo/datagrass
SVN rev:1271 introduced FTP support in PyWPS. Basically a user can define a FTP location where the WPS process output will store the outputs (WPS response as reference).
FTP support is automatically activated when parameter outputPath starts with string "ftp://". The configuration file requires the following variables to be set:
- FTP Path. FTP Path (host+path) where outputdata will be stored: e.g. ftp://127.0.0.1/foo/
- URL parameter should be set to the FTP path
- FTP user login e.g: 'user'. If string is empty , PyWPS will use anonymous login
- FTP password e.g '1234'
- FTP port number. Default port is 21. Non root ports are run in numbers above 1024
Generic "pitfalls" in the configuration file
the maxfilesize defines the maximum input size, this parameter is normally used to set buffer sizes inside pywps. While the code is being executed the python interpreter will have to temporary request a memory allocation with a size identical to maxfilesize. If the OS can't allocate the requested amount, the python interpreter will report a "MemoryError" Exception
"/usr/local/lib/python2.7/dist-packages/pywps-soap_branch-py2.7.egg/pywp s/Parser/Post.py", line 94, in parse inputXml = file.read(maxFileSize) MemoryError [Fri Mar 02 16:04:38 2012] [error] [client 127.0.0.1] Premature end of script headers: wps PyWPS NoApplicableCode: Locator: None; Value: No query string found.
Either the maxfilesize value has to be reduced to allow a malloc() OR the parameter can be set to zero (unlimit input size)
--Wikiadmin 15:41, 10 January 2011 (UTC)