Class: ImageUrlSource

ImageUrlSource(sourceFromTile, opts)

A Source that loads assets from images given a URL and a crop rectangle.

Constructor

new ImageUrlSource(sourceFromTile, opts)

Parameters:
Name Type Description
sourceFromTile function

Function that receives a tile and returns a { url, rect } object, where url is an image URL and rect, when present, is an { x, y, width, height } object in normalized coordinates denoting the portion of the image to use.

opts Object
Properties
Name Type Attributes Default Description
concurrency number <optional>
4

Maximum number of tiles to request at the same time. The limit is per ImageSourceUrl instance.

retryDelay number <optional>
10000

Time in milliseconds to wait before retrying a failed request.

Implements:

Methods

(static) fromString(url, opts)

Creates an ImageUrlSource from a string template.

Parameters:
Name Type Description
url String

Tile URL template, which may contain the following placeholders:

  • {f} : tile face (one of b, d, f, l, r, u)
  • {z} : tile level index (0 is the smallest level)
  • {x} : tile horizontal index
  • {y} : tile vertical index
opts Object

In addition to the options already supported by the ImageUrlSource constructor.

Properties
Name Type Attributes Default Description
cubeMapPreviewUrl String

URL to use as the preview level. This must be a single image containing six cube faces laid out vertically according to the face order parameter.

cubeMapPreviewFaceOrder String <optional>
'bdflru'

Face order within the preview image.

loadAsset(stage, tile, done) → {function}

Loads an Asset from the source.

Parameters:
Name Type Description
stage Stage
tile Tile
done function

Callback.

Implements:
Returns:

Function that cancels the loading when called.

Type
function