Module: ol/source/Raster

ol/source/Raster


Classes

RasterSource
RasterSourceEvent

Members

RasterEventType{string}

Properties:
Name Type Default Description
BEFOREOPERATIONS string beforeoperations
AFTEROPERATIONS string afteroperations

RasterOperationType{string}

Raster operation type. Supported values are 'pixel' and 'image'.

Properties:
Name Type Default Description
PIXEL string pixel
IMAGE string image

Type Definitions

Operation()

source/Raster.js, line 24

A function that takes an array of input data, performs some operation, and returns an array of output data. For pixel type operations, the function will be called with an array of pixels, where each pixel is an array of four numbers ([r, g, b, a]) in the range of 0 - 255. It should return a single pixel array. For 'image' type operations, functions will be called with an array of https://developer.mozilla.org/en-US/docs/Web/API/ImageData and should return a single https://developer.mozilla.org/en-US/docs/Web/API/ImageData. The operations are called with a second "data" argument, which can be used for storage. The data object is accessible from raster events, where it can be initialized in "beforeoperations" and accessed again in "afteroperations".

Options{Object}

Properties:
Name Type Argument Default Description
sources Array.<(module:ol/source/Source~Source|module:ol/layer/Layer~Layer)>

Input sources or layers. Vector layers must be configured with renderMode: 'image'.

operation module:ol/source/Raster~Operation <optional>

Raster operation. The operation will be called with data from input sources and the output will be assigned to the raster source.

lib Object <optional>

Functions that will be made available to operations run in a worker.

threads number <optional>

By default, operations will be run in a single worker thread. To avoid using workers altogether, set threads: 0. For pixel operations, operations can be run in multiple worker threads. Note that there is additional overhead in transferring data to multiple workers, and that depending on the user's system, it may not be possible to parallelize the work.

operationType RasterOperationType <optional>
'pixel'

Operation type. Supported values are 'pixel' and 'image'. By default, 'pixel' operations are assumed, and operations will be called with an array of pixels from input sources. If set to 'image', operations will be called with an array of ImageData objects from input sources.