Class TiledImageSource

An image source powered by OpenLayers to load tiled images. Supports all subclasses of the OpenLayers TileSource.

If the tiles of the source are in a format that is not supported directly by the browser, i.e not JPG/PNG/WebP, then you must pass a decoder with the format constructor option.

To filter out no-data pixels, you may pass the noDataValue option in the constructor.

Example

// To create a source based on the Stamen OpenLayers source, with the 'toner' style.
const source = new TiledImageSource({
source: new Stamen({ layer: 'toner' })
});

// To create a WMS source that downloads TIFF images, eliminating all pixels that have the
// value -9999 and replacing them with transparent pixels.
const source = new TiledImageSource({
source: new TileWMS({
url: 'http://example.com/wms',
params: {
LAYERS: 'theLayer',
FORMAT: 'image/tiff',
},
projection: 'EPSG:3946',
crossOrigin: 'anonymous',
version: '1.3.0',
}),
format: new GeoTIFFFormat(),
noDataValue: -9999,
});

Hierarchy

Constructors

Properties

_downloader: default
_getTileUrl: ((coord, _, proj) => string)

Type declaration

    • (coord, _, proj): string
    • Parameters

      • coord: TileCoord
      • _: number
      • proj: Projection

      Returns string

_sourceExtent: Extent
_tileGrid: TileGrid
containsFn: CustomContainsFn
datatype: TextureDataType

Gets the datatype of images generated by this source.

flipY: boolean

Gets whether images generated from this source should be flipped vertically.

format: ImageFormat
isImageSource: boolean = true
isTiledImageSource: boolean = true
noDataValue: number
olprojection: Projection
source: UrlTile
type: string
version: number

Accessors

  • get colorSpace(): ColorSpace
  • Gets the color space of the textures generated by this source.

    Returns ColorSpace

Methods

  • Adds a listener to an event type.

    Type Parameters

    • T extends "updated"

    Parameters

    Returns void

  • Type Parameters

    • T extends string

    Parameters

    Returns void

  • Returns an adjusted extent, width and height so that request pixels are aligned with source pixels, and requests do not oversample the source.

    Parameters

    • requestExtent: Extent

      The request extent.

    • requestWidth: number

      The width, in pixels, of the request extent.

    • requestHeight: number

      The height, in pixels, of the request extent.

    • margin: number = 0

      The margin, in pixels, around the initial extent.

    Returns {
        extent: Extent;
        height: number;
        width: number;
    }

    The adjusted parameters.

    • extent: Extent
    • height: number
    • width: number
  • Gets whether this source contains the specified extent. If a custom contains function is provided, it will be used. Otherwise, intersects is used.

    This method is mainly used to discard non-relevant requests (i.e don't process regions that are not relevant to this source).

    Parameters

    • extent: Extent

      The extent to test.

    Returns boolean

  • Fire an event type.

    Type Parameters

    • T extends "updated"

    Parameters

    Returns void

  • Disposes unmanaged resources of this source.

    Returns void

  • Parameters

    • url: string
    • signal: AbortSignal

    Returns Promise<Blob>

  • Returns the CRS of this source.

    Returns string

    The CRS.

  • Returns the extent of this source expressed in the CRS of the source.

    Returns Extent

    The extent of the source.

  • Gets the images for the specified extent and pixel size.

    Parameters

    Returns {
        id: string;
        request: (() => Promise<ImageResult>);
    }[]

    An array containing the functions to generate the images asynchronously.

  • Selects the best zoom level given the provided image size and extent.

    Parameters

    • extent: Extent

      The target extent.

    • size: number

      The size in pixels of the target extent.

    Returns number

    The ideal zoom level for this particular extent.

  • Checks if listener is added to an event type.

    Type Parameters

    • T extends "updated"

    Parameters

    Returns boolean

  • Type Parameters

    • T extends string

    Parameters

    Returns boolean

  • Initializes the source.

    Parameters

    • options: {
          targetProjection: string;
      }

      Options.

      • targetProjection: string

        The target projection. Only useful for sources that are able to reproject their data on the fly (typically vector sources).

    Returns Promise<void>

    A promise that resolves when the source is initialized.

  • Test the intersection between the specified extent and this source's extent. This method may be overriden to perform special logic.

    Parameters

    • extent: Extent

      The extent to test.

    Returns boolean

    true if the extent and this source extent intersects, false otherwise.

  • Loads the tile once and returns a reusable promise containing the tile texture.

    Parameters

    • id: string

      The id of the tile.

    • url: string

      The URL of the tile.

    • extent: Extent

      The extent of the tile.

    • createDataTexture: boolean

      Create readable textures.

    • signal: AbortSignal

    Returns Promise<ImageResult>

    The tile texture, or null if there is no data.

  • Loads all tiles in the specified tile range.

    Parameters

    • tileRange: TileRange

      The tile range.

    • crs: string

      The CRS of the extent.

    • zoom: number

      The zoom level.

    • createDataTexture: boolean

      Creates readable textures.

    • signal: AbortSignal

    Returns {
        id: string;
        request: (() => Promise<ImageResult>);
    }[]

  • Removes a listener from an event type.

    Type Parameters

    • T extends "updated"

    Parameters

    Returns void

  • Type Parameters

    • T extends string

    Parameters

    Returns void

  • Check if the tile actually intersect with the extent.

    Parameters

    • extent: Extent

      The extent to test.

    Returns boolean

    true if the tile must be processed, false otherwise.

  • Raises an event to reload the source.

    Returns void

Generated using TypeDoc