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. For Linux installation see this manual.
Table of Contents |
---|
Step 0 Python installations
Make sure Python is pre-installed on your machine, we recommend PythonXY (version 2.7, not 3.x).
...
Python version is 2.7,Result should be like:
Code Block language bash title Show Python version C:\>python --version Python 2.7.6
Python package magic is installed and of version 0.4.6 else see Known Installation Issues
Code Block language bash title Python-Magic package versionnr C:\>pip show python-magic --- Name: python-magic Version: 0.4.6 PyPi Version: 0.4.6 Location: c:\python27\lib\site-packages home_page: http://github.com/ahupp/python-magic Summary: File type identification using libmagic Requires: Required by(0):
- Python package lxml is installed and of version 3.3.5 else download http://www.microsoft.com/en-us/download/details.aspx?id=44266, install this c++ compiler and install lxml with this command :
pip install lxml
Code Block language bash title Python lxml package C:\>pip show lxml --- Name: lxml Version: 3.3.5 PyPi Version: 3.4.0 Location: c:\python27\lib\site-packages home_page: http://lxml.de/ Summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API. Requires: Extra Require [source]: cython(-) Extra Require [cssselect]: cssselect Extra Require [html5]: html5lib Extra Require [htmlsoup]: beautifulsoup4 Required by(5): html5lib[optional], pandas[html], astropy[optional], astropy[doc ], beautifulsoup4[optional]
Step 1 PyWPS
Download PyWPS (version 3.2.1, not 3.2.2)
Step 2 Install PyWPS
Unpack the contents of PyWPS folder and save the entire folder as c:\pywps
. Such that you have c:\pywps\wps.py
. Check if it works command line in python by navigating to c:\pywps
and execute this command:
Code Block | ||
---|---|---|
| ||
C:\>cd pywps C:\pywps>python wps.py PyWPS NoApplicableCode: Locator: None; Value: No query string found. Content-Type: application/xml <?xml version="1.0" encoding="utf-8"?> <ExceptionReport version="1.0.0" xmlns="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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 3 Configure PyWPS
- Create a folder called
c:\pywps\pywps_processes
- Add the file
default.cfg
(fromc:\pywps\pywps
) into it. If you like you can insert your own information in the file.
However, do not forget to :- Set the correct path for
under [server] section.tempPath(
c:/pywps/
temp) - Set
outputPath
under [server] section.(
c:/[webserver]/htdocs/wps/wpsoutput
) - Set
processesPath
toc:/pywps/pywps_processes
- Set the
logFile
to somewhere(
c:/pywps/log
)
- Set the correct path for
The path slashes should conform to python conventions, which happen to be the same as the linux slash convention, and not the windows convention. Note that python paths should never end with a slash!.
Step 4 Configure Apache
Navigate to the Apache folder.
...
Code Block | ||
---|---|---|
| ||
#!C:\python27\python.exe import sys sys.path.insert(0, r"C:/pywps") import os os.environ['PYWPS_CFG']='C:/pywps/pywps_processes/default.cfg' os.environ['MPLCONFIGDIR']='C:/Python27/Lib/site-packages/matplotlib/mpl-data' # Note that WPS runs as apache user and not as you, so many more user variables might be needed. # Restart Apache after adding one. import wps |
Step 5 Install Python PyWPS package
Install the PyWPS Python package:
...
Code Block | ||||
---|---|---|---|---|
| ||||
C:\>pip show pywps --- Name: pywps Version: 3.2.1 PyPi Version: trunk Location: c:\python27\lib\site-packages\pywps-3.2.1-py2.7.egg home_page: http://pywps.wald.intevation.org Summary: PyWPS: Implementation of OGC's Web Processing Service in Python Requires: Required by(0): |
Step 6 Install python-magic
Check if cygmagic.dll or cygmagic-1.dll is on your system. If not install it via installing cygwin (http://cygwin.com/install.html). Install the appropriate version (i.e. 32bit or 64bit). You only need to install the python-magic part of cygwin. If you install all, it is very large (several Gb). You can force installation of python-magic by typing this in the search bar, see window below.
...
Set the path to the bin directory of cygwin and copy cygmagic-1.dll to cygmagic.dll.
Step 7 First test of WPS
Test your WPS by starting Apache server and navigate to http://localhost/cgi-bin/pywps.cgi The result should be something similar to this, meaning that the pywps process runs correctly inside the apache web server.
Code Block | ||
---|---|---|
| ||
<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 8 Testing WPS behavior
Now pywps runs, test for correct WPS behaviour behavior in browser using the syntax in WPS Primer. In c:\pywps\tests\processes
some example processes are included, copy its entire contents to the c:\pywps\pywps_processes
folder (that you configured as processesPath=c:/pywps/pywps_processes
in c:\pywps\pywps_processes\default.cfg
) and find out whether you can get them to run. First test the GetCapabilities request:
...
and then executing any of the available processes
e.g. http://localhost/cgi-bin/pywps.cgi?service=wps&request=Execute&Identifier=dummyprocess&DataInputs=\[input1=42\]&version=1.0.0.
Step 9 Add wps processes
Now add your own Python processes as WPS by copying your processes to the c:\pywps\pywps_processes
folder too. Use the WPS syntax (Setting up a WPS process using PyWPS) for your python functions as in the copied examples. Change 3 things when adding a new WPS process based on these examples:
...