Flask is a microframework for web applications in Python. Some characteristics of Flask:

  • built-in development server and debugger
  • RESTful request dispatching
  • 100% WSGI 1.0 compliant

You can develop your PyWPS application and modules using a local Flask server and then move it to a production environment (e.g. with Apache2 HTTP server).

Start PyWPS server

Start the PyWPS demo-server using Flask’s built-in server:

$ python3 demo.py

You should see some output from the WPS-server that is now running at http://localhost:5000/wps. Alternatively you may use Python2 and issue python demo.py.

Testing the server


You should be able to interact with the WPS-server like any other HTTP-server, i.e. either requesting URLs using your web browser or using commandline tools like wget or curl. For example using wget to fetch the Capabilities of the WPS Server:

$ wget --content-on-error -O - "http://localhost:5000/wps?service=wps&request=getcapabilities"

Or visit the URL directly in the browser:


In both cases you should see the response:

<!-- PyWPS 4.0.0-... -->
<wps:Capabilities xmlns:ows="http://www.opengis.net/ows/1.1"

If anything goes wrong, you should see the result in Flask terminal, for example:


With response:

<?xml version="1.0" encoding="UTF-8"?>
<!-- PyWPS 4.0.0-... -->
<ows:ExceptionReport .... >
<ows:Exception exceptionCode="MissingParameterValue" locator="service" >

And output from Flask in the terminal:

ERROR:PYWPS:Exception: code: 400, locator: service, description: service


The GetCapabilities response in the previous section lists the WPS Processes available on the WPS demo-server.

Issue a DescribeProcess WPS request for the say_hello WPS Process using the URL:

Note that the version parameter is required with most WPS-requests. The output includes the Inputs for this WPS Process:

<!-- PyWPS 4.0.0-beta1 -->
<wps:ProcessDescriptions xmlns:wps="http://www.opengis.net/wps/1.0.0"
service="WPS" version="1.0.0" xml:lang="en-US">
  <ProcessDescription wps:processVersion="" storeSupported="true" statusSupported="true">
    <ows:Title>Process Say Hello</ows:Title>
      <Input minOccurs="1" maxOccurs="1">
        <ows:Title>Input name</ows:Title>
          <ows:DataType ows:reference="urn:ogc:def:dataType:OGC:1.1:string">string</ows:DataType>
        <ows:Title>Output response</ows:Title>
          <ows:DataType ows:reference="urn:ogc:def:dataType:OGC:1.1:string">string</ows:DataType>

This response indicates that the say_hello WPS Process requires one parameter name. Execute the say_hello WPS Process with the URL:

You should see a response like:

<!-- PyWPS 4.0.0-.... -->
<wps:ExecuteResponse xmlns:wps="http://www.opengis.net/wps/1.0.0"
service="WPS" version="1.0.0" xml:lang="en-US"
  <wps:Process wps:processVersion="">
    <ows:Title>Process Say Hello</ows:Title>
  <wps:Status creationTime="2016-08-28T15:14:13Z">
    <wps:ProcessSucceeded>PyWPS Process finished</wps:ProcessSucceeded>
      <ows:Title>Output response</ows:Title>
        <wps:LiteralData dataType="urn:ogc:def:dataType:OGC:1.1:string"
             uom="urn:ogc:def:uom:OGC:1.0:unity">Hello Luis</wps:LiteralData>

NB it is recommended to use HTTP POST requests for invoking WPS Execute operations as normally DataInputs will be more complex.