Functions
-
import {decode} from 'ol/Image';Loads an image and decodes it to an
ImageBitmapifcreateImageBitmap()is supported. Returns the loaded image otherwise.Name Type Description imageHTMLImageElement Image, not yet loaded.
srcstring | undefined srcattribute of the image. Optional, not required if already present.Returns:
Promise resolving to anImageBitmapor anHTMLImageElementifcreateImageBitmap()is not supported.
-
import {load} from 'ol/Image';Loads an image.
Name Type Description imageHTMLImageElement Image, not yet loaded.
srcstring | undefined srcattribute of the image. Optional, not required if already present.Returns:
Promise resolving to anHTMLImageElement.
Type Definitions
-
ImageObject{Object}
-
Properties:
Name Type Description extentExtent | undefined Extent, if different from the requested one.
resolutionResolutionLike | undefined Resolution, if different from the requested one. When x and y resolution are different, use the array type (
[xResolution, yResolution]).pixelRationumber | undefined Pixel ratio, if different from the requested one.
imageImageLike Image.
-
Loader function used for image sources. Receives extent, resolution and pixel ratio as arguments. The function returns a promise for an
image object. -
A function that takes an
ImageWrapperfor the image and a{string}for the src as arguments. It is supposed to make it so the underlying imagegetImageis assigned the content specified by the src. If not specified, the default isfunction(image, src) { image.getImage().src = src; }Providing a custom
imageLoadFunctioncan be useful to load images with post requests or - in general - through XHR requests, where the src of the image element would be set to a data URI when the content is loaded. -
Loader function used for image sources. Receives extent, resolution and pixel ratio as arguments. For images that cover any extent and resolution (static images), the loader function should not accept any arguments. The function returns an
image, animage object, or a promise for the same. For loaders that generate images, the promise should not resolve until the image is loaded. If the returned image does not match the extent, resolution or pixel ratio passed to the loader, it has to return animage objectwith theimageand the correctextent,resolutionandpixelRatio.