Standards /

WCPS-Tutorial / A first simple request

A WCPS ProcessCoverage request uniformly consists of one expression which is evaluated against one or more coverages and returns a coverage, coverage set, or derived alphanumeric data.

Example: Coverage rgb is a 2-D RGB image of size 400x344 pixels. The request below retrieves the entire image, without any change in CRS, size, or cell value ("radiometry").

for c in ( rgb )
        encode( c, "jpeg" )

The result of this request is displayed below:

WCPS is not constrained to simply accessing coverages. The first argument of the encode() function can be an arbitrarily complex expression based on the WCPS coverage language elements.

Example: "an intensity-inverted cutout in the blue channel":

for c in ( rgb )
        encode( (255c -[50:150,50:150], "jpeg" )

This is the outcome of the above request:

The encode() function is always required when the overall result of a return clause is a coverage. Obviously the format chosen must support the coverage wrt. number of dimensions (JPEG cannot handle 3D) and cell type (JPEG also cannot handle floating-point pixels). If the overall result of the request is just a scalar, then no encoding is needed.

Example: "the number of pixels with zero-valued red components":

for c in ( rgb )
        count( = 0 )

Next, the most important language constructs will be introduced step by step.

Background information:

  • The format names available are depending on the server implementation.
  • Some formats support further parameter (such as JPEG quality indicators); the encode() function allows passing such extra parameters as an optional string. The syntax and semantics of this string is currently not fixed in the standard, but may be so in future.

See manual: coverageListExpr