Module: ol/source/ImageCanvas

ol/source/ImageCanvas


Classes

ImageCanvasSource

Type Definitions

FunctionType()

A function returning the canvas element ({HTMLCanvasElement}) used by the source as an image. The arguments passed to the function are: module:ol/extent~Extent the image extent, {number} the image resolution, {number} the pixel ratio of the map, module:ol/size~Size the image size, and module:ol/proj/Projection~Projection the image projection. The canvas returned by this function is cached by the source. The this keyword inside the function references the module:ol/source/ImageCanvas~ImageCanvasSource.

Options{Object}

Properties:
Name Type Argument Default Description
attributions module:ol/source/Source~AttributionLike <optional>

Attributions.

canvasFunction module:ol/source/ImageCanvas~FunctionType <optional>

Canvas function. The function returning the canvas element used by the source as an image. The arguments passed to the function are: module:ol/extent~Extent the image extent, {number} the image resolution, {number} the pixel ratio of the map, module:ol/size~Size the image size, and module:ol/proj/Projection~Projection the image projection. The canvas returned by this function is cached by the source. If the value returned by the function is later changed then changed should be called on the source for the source to invalidate the current cached image. See: module:ol/Observable~Observable#changed

imageSmoothing boolean <optional>
true

Deprecated. Use the interpolate option instead.

interpolate boolean <optional>
true

Use interpolated values when resampling. By default, linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.

projection module:ol/proj~ProjectionLike <optional>

Projection. Default is the view projection.

ratio number <optional>
1.5

Ratio. 1 means canvases are the size of the map viewport, 2 means twice the width and height of the map viewport, and so on. Must be 1 or higher.

resolutions Array.<number> <optional>

Resolutions. If specified, new canvases will be created for these resolutions

state module:ol/source/Source~State <optional>

Source state.