Raster

The raster configuration items are used to define the source of a raster and to expose functions that are supported by an exposed raster.

Currently two database are supported as sources of rasters, Oracle and Postgres, the requirements for the rasters layers that need to be satisfied before they are usable within Weave are documented elsewhere.

Namespace

urn:com.cohga.weave.raster#1.0

Raster Source

Before anything can be done with a raster layer a configuration item must be created that tells Weave where the raster is located and some information about how it is structured.

A raster source is not a single “raster” but rather a table that contains multiple rasters layers, which individual raster layer(s) that are later used for calculations is determined by the calculation and my be based on thing like an overlap between the raster layer and some provided geometry, or a specific raster layer configured in the function.

source

Properties

Name

Type

Required

Description

id

string

yes

Unique identifier for this configuration

datasource

string

yes

The id of the datasource that contains the raster layer(s)

table

string

yes

The name of the raster layer table

column

string

yes

The name of the column withing the raster layer table that contains the raster

rasteridcolumn

string

no

The name of the column withing the raster layer table that contains the unique id of the raster. Default is “id”

crs

string

yes, unless srid is set

The Coordinate Reference System that the raster is using

srid

integer

yes, unless crs is set

The Spatial Reference ID that the raster is using

Sub-tags

None

Example

Define an Oracle raster source where the raster layers are stored in a GIS.FLOOD table

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:raster="urn:com.cohga.weave.raster#1.0"> <raster:source id="flood.raster"> <datasource>ds.oracle</datasource> <table>GIS.FLOOD</table> <column>RASTER</column> <rasteridcolumn>ID</rasteridcolumn> <crs>EPSG:4283</crs> </raster:source> </config>

Raster Functions

Once a raster source has been defined functions can then be added to use the raster source as the provider of the data for a calculation. Currently two raster function are available, “summary” and “value”.

A summary function provides summary of information based on polygon areas that intersect the raster(s).

A value function provides a distinct value based on a point that intersects a raster.

These two raster function, if defined, are exposed by the Weave server using the REST API, specifically the Function REST API, that is they are raster specific functions that are exposed via a generic function calling REST API. The Function REST API is used to expose any user callable function, spatial or otherwise, and the two raster functions are just implementations of the function API that are registered by the system when their configuration is processed and perform raster related operations.

The two raster function have a number of required parameters, for example the id of the raster source that will be used to provide the data for the raster operation, by they can be supplemented with additional parameters, via the configuration, that can be used to determine which raster layers are used for the calculations. For example if you have multiple raster layers that cover the same area but represent different years and there is a column in the raster table that indicates which year the raster relates to they you can add a “year” parameter to the function configuration and then the caller of the function would need to provide the source geometry and the year value when calling the function, and Weave will then use the year parameter to find the matching raster(s) and only perform the calculation on those layers.

valuefunction

Properties

Name

Type

Required

Description

id

string

yes

Unique identifier for this configuration

name

string

no, uses id if not set

The name of the function that will be exposed, this is the name of the function that the caller will use when they want to execute this function

rasterid

string

no

If this function should always use a specific raster this is the id of the raster

Sub-tags

Name

Type

Cardinality

Name

Type

Cardinality

parameters

urn:com.cohga.weave.raster#1.0:parameters

0..n

summaryfunction

Properties

Name

Type

Required

Description

id

string

yes

Unique identifier for this configuration

name

string

no, uses id if not set

The name of the function that will be exposed, this is the name of the function that the caller will use when they want to execute this function

rasterid

string

no

If this function should always use a specific raster this is the id of the raster

bands

string

no

Which bands in the raster to perform the function on

geometryoverlap

“nothing”, “union” or “error”

no

What to do if the source geometry contains multiple polygons and there is an overlap between two or more polygons. Default is nothing.

nothing passes the geometry as is to the database

union generates a union of the geometry before passing it to the database

error throws an error if there are any overlaps

Sub-tags

Name

Type

Cardinality

Name

Type

Cardinality

parameters

urn:com.cohga.weave.raster#1.0:parameters

0..1

parameters

Properties

None

Sub-tags

Name

Type

Cardinality

Name

Type

Cardinality

parameter

urn:com.cohga.server.data.database#1.0:parameter

1..n

Note

The parameter tag has the same configuration as a data definition parameter, so it is linked to the existing documentation.

Examples

Create a raster value function that queries a specific raster layer

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:raster="urn:com.cohga.weave.raster#1.0"> <raster:valuefunction id="flood.value"> <raster>flood.raster</raster> <rasterid>5</rasterid> </raster:valuefunction> </config>

Create a raster value function that uses a year parameter to determine which raster to query

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:raster="urn:com.cohga.weave.raster#1.0"> <raster:valuefunction id="flood.value"> <raster>flood.raster</raster> <parameters> <parameter name="year" column="YEAR" type="integer" required="true"/> <parameters> </raster:valuefunction> </config>

Create a raster summary function that generates statistics for a specific raster layer and generates an error if any source geometries overlap