Class: TileImage

ol/source/TileImage~TileImage


import TileImage from 'ol/source/TileImage';

Base class for sources providing images divided into a tile grid.

new TileImage(options)

source/TileImage.js, line 64
Name Type Description
options

Image tile options.

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

Attributions.

cacheSize number 2048

Cache size.

crossOrigin null | string

The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.

opaque boolean true

Whether the layer is opaque.

projection module:ol/proj~ProjectionLike

Projection.

reprojectionErrorThreshold number 0.5

Maximum allowed reprojection error (in pixels). Higher values can increase reprojection performance, but decrease precision.

state module:ol/source/State

Source state.

tileClass module:ol/ImageTile~TileClass

Class used to instantiate image tiles. Default is module:ol/ImageTile~ImageTile.

tileGrid module:ol/tilegrid/TileGrid~TileGrid

Tile grid.

tileLoadFunction module:ol/Tile~LoadFunction

Optional function to load a tile given a URL. The default is

function(imageTile, src) {
  imageTile.getImage().src = src;
};
tilePixelRatio number 1

The pixel ratio used by the tile service. For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px by 512px images (for retina/hidpi devices) then tilePixelRatio should be set to 2.

tileUrlFunction module:ol/Tile~UrlFunction

Optional function to get tile URL given a tile coordinate and the projection.

url string

URL template. Must include {x}, {y} or {-y}, and {z} placeholders. A {?-?} template pattern, for example subdomain{a-f}.domain.com, may be used instead of defining each one separately in the urls option.

urls Array.<string>

An array of URL templates.

wrapX boolean

Whether to wrap the world horizontally. The default, is to request out-of-bounds tiles from the server. When set to false, only one world will be rendered. When set to true, tiles will be requested for one world only, but they will be wrapped horizontally to render multiple worlds.

transition number

Duration of the opacity transition for rendering. To disable the opacity transition, pass transition: 0.

Fires:

Methods

setRenderReprojectionEdges(render)

source/TileImage.js, line 355

Sets whether to render reprojection edges or not (usually for debugging).

Name Type Description
render boolean

Render the edges.

setTileGridForProjection(projection, tilegrid)

source/TileImage.js, line 379

Sets the tile grid to use when reprojecting the tiles to the given projection instead of the default tile grid for the projection.

This can be useful when the default tile grid cannot be created (e.g. projection has no extent defined) or for optimization reasons (custom tile size, resolutions, ...).

Name Type Description
projection module:ol/proj~ProjectionLike

Projection.

tilegrid module:ol/tilegrid/TileGrid~TileGrid

Tile grid to use for the projection.