The PyWPS software was originally developed to use under Linux (Debian). However, it is also possible to use the software in a Windows environment for example for testing purposes. To do so, Apache server has to be installed on the system.
Step 1:
Download PyWPS
Step 2:
Unpack the contents of PyWPS folder and save the entire folder as c:\pywps
(such that you have c:\pywps\wps.py
)
Step 3:
Create a folder called c:\pywps\pywps_processes
and add the file default.cfg
(from c:\pywps\pywps
), if you like you can insert your own information in the file. However, do not forget to set the correct path for tempPath
and outputPath
under [server] section. Set processesPath
to c:/pywps/python_processes
(the path slashes should conform python conventions, which happen to be the linux convention, and not the windows conventions).
Step 4:
Navigate to the Apache folder. If this is not installed download the newest stable release of Apache (https://httpd.apache.org/download.cgi). In this folder you find a sub folder called cgi-bin
create a file called pywps.cgi
in this folder and insert the following code in it, after checking the python path (and correcting it, so, for example if you have Python2.7 installed, the first line should be #!c:\python27\python.exe):
#!C:\python\python.exe import sys sys.path.insert(0, r"C:\pywps") import os os.environ['PYWPS_CFG']='C:/pywps/pywps_processes/default.cfg' import wps
Step 5:
Install the PyWPS Python package: on the command line c:\pywps> python c:\pywps\setup.py install
, or open the Windows command line tool (start > run), drag and drop setup.py
from your c:\pywps
folder, type install after the location of the setup file and click ok. The PyWPS Python package is now installed.
Step 6:
Test your WPS by starting Apache server and navigate to http://localhost/cgi-bin/pywps.cgi
The result should be something similar to this:
<ExceptionReport xmlns="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd"> <Exception exceptionCode="NoApplicableCode"> <ExceptionText>'No query string found.'</ExceptionText> </Exception> </ExceptionReport>
Step 7:
Add your own Python processes as WPS by copying your processes to the c:\pywps\python_processes
folder.
In c:\pywps\tests\processes
some example processes are included, copy these to c:\pywps\python_processes
folder and find out whether you can get them to run.
If you get errors on windows (see apache log directory) then install cygwin and follow this procedure. On Windows, install Cygwin (http://cygwin.com/install.html). To find the libraries, add /bin to the $PATH.
Check whether all processes are recognized by doing a GetCapabilities request (http://localhost/cgi-bin/pywps.cgi?service=wps&request=GetCapabilities&version=1.0.0) or executing to any of the processes (e.g. http://localhost/cgi-bin/pywps.cgi?service=wps&request=Execute&Identifier=dummyprocess&DataInputs=[input1=42]&version=1.0.0).
Note*: If you get this error Internal Server Error
, please chekc your apache error.log in c:\Program Files (x86)\Apache Software Foundation\Apache2.2\logs
. In some cases it might contain this error message ImportError: No module named magic\r
. In this case please manually install the libmagic package from https://github.com/heynemann/libmagic. For your convenience we included a windows distributable here until the official binary is available at github. Restart apache afterwards (type services
in your windows start menu or click small apache icon in icon tray).
If you still get errors (failed to find libmagic
, install cygwin.
Note:
PyWPS can also be used with the Q-GIS WPS plugin by Dr. Horst Duester
Official documentation on PyWPS (v3.2.0) can be found here