Process structure

In the file containing the process, there must be one class with the name Process, which is instance of pywps.Process.WPSProcess class. Each process must contain at least two methods: pywps.Process.WPSProcess.__init__() and pywps.Process.WPSProcess.execute() .

Process initialization: __init__ method

This method is the constructor for the actual process. It has to invoke the pywps.Process.WPSProcess.__init__() method of the superior WPSProcess class with process configuration options, described in pywps.Process.WPSProcess in more detail.

The process can then define several pywps.Process.InAndOutputs.Input and pywps.Process.InAndOutputs.Output instances. Several methods can be used for this, namely pywps.Process.WPSProcess.addLiteralInput(), pywps.Process.WPSProcess.addComplexInput(), pywps.Process.WPSProcess.addBBoxInput() for inputs and pywps.Process.WPSProcess.addLiteralOutput(), pywps.Process.WPSProcess.addComplexOutput(), pywps.Process.WPSProcess.addBBoxOutput() for outputs.

Process execution: execute method

The pywps.Process.WPSProcess.execute() method, which is originally empty, is called by PyWPS for process execution. The actual calculation is to be done here. When the process returns any text, it is handled as an error message. When a process is successfully calculated, this method returns None.

Example of PyWPS process

After adding “returner” string to __all__ array, in the __init__.py file in the PyWPS Processes directory, we can try GetCapabilities, DescribeProcess and Execute requests.