Module InAndOutputs

Inputs and outputs of OGC WPS Processes

Class Input

class pywps.Process.InAndOutputs.Input(identifier, title, abstract=None, metadata=[], minOccurs=1, maxOccurs=1, type=None)

Class WPS Input

Parameters:
  • identifier – input identifier
  • title – input title
  • abstract – input description.
  • metadata – List of metadata references.
  • minOccurs – minimum number of occurrences.
  • maxOccurs – maximum number of occurrences.
  • type – one of “LiteralValue”, “ComplexValue” or “BoundingBoxValue”
identifier

input identifier

title

input title

abstract

input abstract

metadata

input metadata reference

minOccurs

minimum occurense

maxOccurs

maximum occurense

type

type, one of “LiteralValue”, “ComplexValue”, “BoundingBoxValue”

value

actual value of this input

ms

magic cookie

getValue(idx=0)

Get this value

setValue(input)

Control in some way the input value from the client

Parameters:input – input value, parsed in pywps.Parser.Execute

Class LiteralInput

class pywps.Process.InAndOutputs.LiteralInput(identifier, title, abstract=None, metadata=[], minOccurs=1, maxOccurs=1, dataType=<type 'str'>, uoms=(), values='*', spacing=None, default=None)

Literal input type of input.

Parameters:
  • identifier – input identifier
  • title – input title
  • abstract – input description. Default: None
  • uoms – List of string value units
  • minOccurs – minimum number of occurrences.
  • maxOccurs – maximum number of occurrences.
  • allowedValues

    List of strings or lists of allowed values, which can be used with this input. You can set interval using list with two items, like:

    (1,2,3,(5,9),10,"a",("d","g"))
    

    This will produce allowed values 1,2,3,10, “a” and any value between 5 and 9 or “d” and “g”.

    If “*” is used, it means “any value”

  • typetypes.TypeType value type, e.g. Integer, String, etc. you can uses the types module of python.
  • default – default value.
  • spacing
dataType

types.TypeType type of literal data. Default is integer

uoms

list of units

values

allowed values

default

default value

spacing

Note

this attribute is not used

uom

units

getValue()

Get the input value

Returns:value
setValue(input)

Set input value to this input

Parameters:input – input parsed by parsers
Returns:None or Error message

Class ComplexInput

class pywps.Process.InAndOutputs.ComplexInput(identifier, title, abstract=None, metadata=[], minOccurs=1, maxOccurs=1, maxmegabites=None, formats=[{'mimeType': None}])

ComplexInput type

Parameters:
  • identifier – input identifier
  • title – input title
  • abstract – input description.
  • metadata – List of metadata references.
  • minOccurs – minimum number of occurencies.
  • maxOccurs – maximum number of occurencies.
  • formats

    List of objects according to table 23 (page 25). E.g.

    [
        {"mimeType": "image/tiff"},
        {
            "mimeType": "text/xml",
            "encoding": "utf-8",
            "schema":"http://foo/bar"
        }
    ]
    
  • maxmegabites – Maximum input file size. Can not be bigger, as maxfilesize defined in global configuration file.
maxFileSize

maximal allowed file size

formats

list of supported formats

format

the final format

value

file name with the complex data

checkMimeTypeIn(fileName)

Check, if the given mimetype is in self.formats checkMimeType is done after process.format is set by parsing user’s content. 1) if process.format[mimetype] has content it will be check in formats 2) if process.format[mimetype]–>None assume process.format as first in list

  1. no exceptions should be risen
  1. If formats dict is empty then there is nothing that can be done, and self.format=None

4) As request by wps-grass-process, in case of missing information even schema is passed. This is necessary for vector processes and to differenciate between text/xml from GML and KML :param fileName: :param mimeType:

downloadData(url)

Download data from given url. Do not download more, then maxFileSize

Parameters:url – URL where the data are lying
downloadData2(url)

Download data from given file url.

Parameters:url – File URL where the data are lying
getValue(asFile=False)

Get this value

Parameters:asFile – return the value not as file name (default), but as file object
Returns:value
Return type:string or file
onMaxFileSizeExceeded(what)

Empty method, called, when there was any problem with the input.

Parameters:what – Error code
onNotFound(what)

Empty method, called, when there was any problem with the input.

Parameters:what – Error code
onProblem(what, why)

Empty method, called, when there was any problem with the input. This method is replaced in Execute.consolidateInputs, basically input.onProblem = self.onInputProblem therefore Exception raise is implemented in Execute.onInputProblem() :param what: Message with error description :param why: Error code

setMimeType(input)

Sets the MimeType from input before going to setValue() this allows for some self.format to be filled febore base64 decoding. URL inputs don’t have an input[], since they are just URLs. There mimeType was implemented to URL references, basically it sets a self.format based on the input provided by the user e.g:http://localhost/wps.cgi?request=Execute&service=wps&version=1.0.0&identifier=geotiff2png&datainputs=[input=@xlink:href=http://rsg.pml.ac.uk/wps/testdata/elev_srtm_30m.tif@method=POST@mimeType=text%2Fxml] this example shall raise an exception

setValue(input)

Set input value for this input

Parameters:input – parsed input value
storeData(data)

Store data from given file. Not bigger, then maxFileSize

Parameters:data (string) – the data, which should be stored

Class BoundingBoxInput

class pywps.Process.InAndOutputs.BoundingBoxInput(identifier, title, abstract=None, metadata=[], minOccurs=1, maxOccurs=1, dimensions=None, crss=[])

Add BoundingBox input

Parameters:
  • identifier – input identifier
  • title – input title
  • abstract – input description.
  • metadata – List of metadata references.
  • minOccurs – minimum number of occurrences.
  • maxOccurs – maximum number of occurrences.
  • crss – List of strings supported coordinate systems.
crss

Supported coordinate systems

dimensions

Bbox dimensions

crs

Used coordinate system

coords

List of list of coordinates in form:

(
    (minx,miny [, minz,  [...] ] ),
    (maxx,maxy [, minz, [...] ])
    [, (maxx,maxy [, maxz, [...] ]),
        [, ...]
    ]
)

So, most common case:

((minx,miny),(maxx, maxy))
getValue()

Get this value

Returns:bounding box in format:
(minx, miny, maxx, maxy)
setValue(input)

Set value of this input

Parameters:input

bounding box parsed input in format:

{identifier:"id",dimensions:2, value:(minx,miny,maxx,maxy),
crs:"epsg4326"}

or similar

Class Output

class pywps.Process.InAndOutputs.Output(identifier, title, abstract=None, metadata=[], type=None, asReference=False)

Class WPS Input

Parameters:
  • identifier – input identifier
  • title – input title
  • abstract – input description.
  • metadata – List of metadata references.
  • type – one of “LiteralValue”, “ComplexValue” or “BoundingBoxValue”
  • asReference (boolean) – whether this output will be given back as reference or as file
identifier
title
abstract
metadata
type

“ComplexValue”, “LiteralValue”, “BoundingBoxValue”

asReference

this output should be formated as reference (URL) or give the file content back

value

output value

ms

mime cookie

setValue(value)

Set this output value

Class LiteralOutput

class pywps.Process.InAndOutputs.LiteralOutput(identifier, title, abstract=None, metadata=[], uoms=(), dataType=<type 'str'>, default=None, asReference=False)

Literal output class

Parameters:
  • identifier – input identifier
  • title – input title
  • abstract – input description. Default: None
  • metadata – List of meatadata references
  • uoms – List of string values units
  • dataTypetypes.TypeType value type, e.g. Integer, String, etc. you can uses the “types” module of python.
  • default – default value.
  • asReference – whether this output will be given back as reference or as file

Class ComplexOutput

class pywps.Process.InAndOutputs.ComplexOutput(identifier, title, abstract=None, metadata=[], formats=[{'mimeType': None}], asReference=False, projection=None, bbox=None, useMapscript=False)

Complex value output

Parameters:
  • identifier – output identifier
  • title – output title
  • metadata – List of metadata references
  • formats

    List of format structure according to table 23 (page 25). E.g.:

    [
        {"mimeType": "image/tiff"},
        {
            "mimeType": "text/xml",
            "encoding": "utf-8",
            "schema":"http://foo/bar"
        }
    ]
    
  • asReference – whether this output will be given back as reference or as file
  • projection – proj4 text, used for the proj init parameter, e.g. “epsg:4326”, used for mapserver
  • bbox – of 4 elements (minx,miny,maxx,maxy), used for mapserver
  • useMapscript – For this output, setup special MapServer MapFile, and give the output back as link to it, WMS, WCS or WFS
formats

list of supported formats.:

[
    {
        'mimeType':'text/xml',
        'encoding':'utf-8',
        'schema':'http://schemas.opengis.net/gml/3.2.1/gml.xsd'
    },
    {
        ....
    }
]
format

file format of the input file

projection

file projection (used by mapserver, see useMapscript below), is not set, will be determined automatically

bbox

data bounding box (used by mapserver, see useMapscript below) if not set, will be determined automatically

width

(used by mapserver, see useMapscript below) if not set, will be determined automatically

height

(used by mapserver, see useMapscript below) if not set, will be determined automatically

useMapscript

If set to true and asReference is set to true (by request), PyWPS will gerenate UMN MapServer mapfile and point the reference URL to it, so that raster layer will be accessible as OGC WCS and vector layer will be accessible as OGC WFS. This enables the client more flexible bindings of resulting ouput files.

Attributes projection, bbox, width and height will be used. If not set, they will be determined using gdal/ogr libraries. If something does not work, try to adjust them manualy.

Unlike ComplexInput, the check for mimeType is done in Execute during output consolidation.

onProblem(what, why)

Empty method, called, when there was any problem with the input. This method is replaced in Execute.consolidateInputs, basically output.onProblem = self.onOutputProblem therefore Exception raise is implemented in Execute.onInputProblem() :param what: Message with error description :param why: Error code

setValue(value)

Set the output value

Parameters:value (string or file) – value to be returned (file name or file itself)

Class BoundingBoxOutput

class pywps.Process.InAndOutputs.BoundingBoxOutput(identifier, title, abstract=None, metadata=[], crss=[], dimensions=None, asReference=False)

Bounding box ouput

Parameters:
  • identifier – input identifier
  • title – input title
  • abstract – input description.
  • crss – List of strings of supported coordinate systems.
  • dimensions – number of dimensions
  • asReference – whether this output will be given back as reference or as file
crss

list of supporte coordinate systems

crs

coordinate system

dimensions

bbox dimensions

coords
setValue(value)

Set value to bbox output

Parameters:value

boundngbox:

(minx,miny,maxx,maxy)

Table Of Contents

Previous topic

Module Lang

Next topic

Module Soap

This Page