Class: RasterSource


import RasterSource from 'ol/source/Raster';

A source that transforms data from any number of input sources using an module:ol/source/Raster~Operation function to transform input pixel values into output pixel values.

new RasterSource(options)

source/Raster.js, line 143
Name Type Description


Name Type 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

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

lib Object

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

threads number

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 '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.




getProjection(){module:ol/proj/Projection~Projection} inherited

source/Source.js, line 119

Get the projection of the source.


getState(){module:ol/source/State} inherited

source/Source.js, line 136

Get the state of the source, see module:ol/source/State~State for possible states.


refresh() inherited

source/Source.js, line 151

Refreshes the source and finally dispatches a 'change' event.

setAttributions(attributions) inherited

source/Source.js, line 162

Set the attributions of the source.

Name Type Description
attributions module:ol/source/Source~AttributionLike | undefined

Attributions. Can be passed as string, Array<string>, module:ol/source/Source&tilde;Attribution, or undefined.

setOperation(operation, opt_lib)

source/Raster.js, line 262

Set the operation.

Name Type Description
operation module:ol/source/Raster~Operation

New operation.

lib Object

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