A tileset model that can access an OGC WMTS server.

Typically, you don't need to call the constructor yourself. Instead, use the factory methods createFromURL or createFromCapabilities to create an instance of this model. The following example demonstrates how to set up a WMTSTileSetModel to retrieve WMTS tiles for a given service URL and layer name:

WMTSTileSetModel.createFromURL("http://sampleservices.luciad.com/wmts", {layer: "92c09725-a9c5-46fb-bffd-d9e23b4abbf2"})
.then(function(model) {
//Create a layer for the WMTS model
const layer = new RasterTileSetLayer(model);
//Add the layer to the map
map.layerTree.addChild(layer);
});

If you want to access the WMTS server capabilities and explore the service metadata and available data sets, you must create a WMTSCapabilities instance first. You can also use this instance to create a WMTSTileSetModel afterwards:

const capabilitiesPromise = WMTSCapabilities.fromURL("http://sampleservices.luciad.com/wmts");
capabilitiesPromise.then(function(capabilities) {
//Create a model using the capabilities
const model = WMTSTileSetModel.createFromCapabilities(capabilities, {layer: "92c09725-a9c5-46fb-bffd-d9e23b4abbf2"});
//Create a layer for the WMTS model
const layer = new RasterTileSetLayer(model);
//Add the layer to the map
map.layerTree.addChild(layer);
});

Supported versions

Currently only WMTS services that support version 1.0 of the OGC WMTS specification are supported. Also, only KVP GetTile request encodings are currently supported. SOAP or RESTful WMTS GetTile request encodings are not supported.

Hierarchy

Constructors

Accessors

  • get baseURL(): string
  • The base URL configures the location of the tile server. Please refer to getTileURL for details on how the base URL is used to obtain tiles.

    Returns string

  • set baseURL(value): void
  • Parameters

    • value: string

    Returns void

  • get bounds(): null | Bounds
  • The Bounds by which the geometry of this Bounded object is bounded or null if the bounds is not defined.

    Returns null | Bounds

  • get coordinateType(): CoordinateType
  • The coordinate type of geometries in this model

    Returns CoordinateType

  • get credentials(): boolean
  • Indicates whether or not credentials should be included with HTTP requests.

    Set this to true if the server requires credentials, like HTTP basic authentication headers or cookies. You should disable credentials if the server is configured to allow cross-origin requests from all domains (Acces-Control-Allow-Origin=*). If the server allows CORS requests from all domains, the browser will block all requests where credentials=true.

    Once set, all subsequent HTTP requests will use the newly set value.

    The default value is false.

    Returns boolean

  • set credentials(value): void
  • Parameters

    • value: boolean

    Returns void

  • get dataType(): RasterDataType
  • Returns the data type of this RasterTileSetModel.

    Returns RasterDataType

  • get dimensions(): null | object
  • Dimension parameters to send along with WMTS GetTile request. Typical dimensions are TIME and ELEVATION.

    The object literal can contain simple key/value pairs. Dimension names will be prefixed with "DIM_" in the WMTS requests, if this is not already the case. The dimension names TIME and ELEVATION will never be prefixed. Accepted values are strings, numbers, booleans. A ProgrammingError will be thrown if values of another type are used. Values must not be URL encoded. Assigning other values than object literals to dimensions will throw a ProgrammingError.

    Assigning to this property will automatically trigger a refresh of the visualization on the map.

    The example below configures a WMTSTileSetModel to request temperature data on the 1st of july 2016, at ground level.

    wmtsTileSetModel.dimensions = {
    TIME: "2016-07-01T12:00:00.000Z",
    ELEVATION: 0
    };

    Returns null | object

    Since

    2021.0

  • set dimensions(value): void
  • Parameters

    • value: null | object

    Returns void

  • get levelCount(): number
  • The number of available detail levels. Level 0 is the coarsest level.

    Returns number

  • get modelDescriptor(): ModelDescriptor
  • An object containing metadata about this model

    Returns ModelDescriptor

  • set modelDescriptor(modelDescriptor): void
  • An object containing metadata about this model

    Parameters

    Returns void

  • get requestHeaders(): null | HttpRequestHeaders
  • Headers to send with every HTTP request.

    An object literal that represents the headers to send with every HTTP request. The property names represent HTTP header names, the property values represent the HTTP header values. This property can be set dynamically (post-construction). Once set, all subsequent HTTP requests will use the newly set headers.

    Note that when custom headers are being sent to a server on another domain, the server will have to properly respond to pre-flight CORS requests (a HTTP OPTION request sent by the browser before doing the actual request). The server has to indicate that the header can be used in the actual request, by including it in the pre-flight's Access-Control-Allow-Headers response header.

    The default value is null.

    Returns null | HttpRequestHeaders

  • set requestHeaders(value): void
  • Parameters

    Returns void

  • get requestParameters(): null | HttpRequestParameters
  • Custom request parameters to send along with WMTS GetMap and GetFeatureInfo request. The object literal can contain simple key/value pairs. If you try to configure request parameters that are part of the WMTS standard, a ProgrammingError will be thrown. For example, adding a "layers" request parameter is not allowed. Accepted values are strings, numbers and booleans. A ProgrammingError will be thrown if values of another type are used. Values must not be URL encoded.

    Assignments of other values than object literals to requestParameters will throw an Error. Clearing the parameters can be done by assigning null or an empty object literal to requestParameters. In order to trigger a refresh of the visualization on the map, can call invalidate.

    Returns null | HttpRequestParameters

    Since

    2021.0

  • set requestParameters(value): void
  • Parameters

    Returns void

  • get subdomains(): string[]
  • getTileURL will replace the {s} pattern in baseURL with values from subdomains. This will cause tile requests to be spread across different subdomains. Browsers limit the amount of connections to a single domain. Using subdomains avoids hitting this limit.

    The subdomains array cannot be empty if the model's baseURL contains the {s} subdomain hook.

    Returns string[]

  • set subdomains(val): void
  • Parameters

    • val: string[]

    Returns void

Methods

  • Returns the bounds of the tile set at the specified detail level.

    Parameters

    • level: number

      the requested detail level.

    Returns null | Bounds

    the bounds of the raster data at the specified detail level. It returns null if the level does not exist.

    Since

    2023.0

  • Loads a tile from the tileset.

    Parameters

    • tile: TileCoordinate

      the coordinate of the tile

    • onSuccess: ((tile, image) => void)

      the callback function that should be invoked when the tile was successfully loaded The function will receive two arguments, the tile coordinate that was passed to this function and an Image object.

    • onError: ((tile, error?) => void)

      the callback function that should be invoked when the tile could not be loaded The function will receive two arguments, the tile coordinate that was passed to this function and an optional Error object.

        • (tile, error?): void
        • Parameters

          Returns void

    • abortSignal: null | AbortSignal

      an AbortSignal that signals when a tile request is cancelled

    Returns void

  • Returns the pixel density of the raster data at the specified detail level. The pixel density is the number of raster elements per spatial unit , i.e. (tile pixel width) / (tile spatial width) and (tile pixel height) / (tile spatial height area), where the tile spatial dimensions are in the tilesets reference.

    Parameters

    • level: number

      the requested detail level

    Returns null | number[]

    the pixel density of the raster data at the specified detail level. It returns null if the level does not exist.

  • Returns the bounds of a given tile in the tile set. The bounds are calculated based on the model bounds and the model's tileset structure.

    Parameters

    • tile: TileCoordinate

      The tile coordinate for which you want to calculate the bounds

    Returns Bounds

    The bounds of the requested tile coordinate in the model's reference.

    Since

    2020.1

  • Returns the number of columns in the tile grid at the given level. Each level should have twice the number of columns of the previous one.

    Parameters

    • level: number

      the level to be queried

    Returns null | number

    the number of tile columns on the specified level

  • Loads a tile from the tileset. The default implementation of this method calls the getImage method.

    The following code snippet illustrates how this method can be overridden.

    model.getTileData = function(tile, onSuccess, onError) {
    fetch(url).then(function(response) {
    response.arrayBuffer().then(function(arrayBuffer) {
    onSuccess(tile, {
    data: arrayBuffer,
    mimeType: "image/jpeg"
    });
    })
    });

    Parameters

    • tile: TileCoordinate

      the coordinate of the tile

    • onSuccess: ((tile, data) => void)

      the callback function that should be invoked when the tile was successfully loaded The function will receive two arguments, the tile coordinate that was passed to this function and a TileData object.

    • onError: ((tile, error) => void)

      the callback function that should be invoked when the tile could not be loaded The function will receive two arguments, the tile coordinate that was passed to this function and an optional Error object.

        • (tile, error): void
        • Parameters

          Returns void

    • abortSignal: null | AbortSignal

      an AbortSignal that signals when a tile request is cancelled.

    Returns void

  • Returns the height, in pixels, of the tiles at the specified detail level. All tiles are assumed to have the same resolution.

    Parameters

    • level: number

      the requested detail level

    Returns null | number

    the height of the tiles at the specified detail level

  • Returns the number of rows in the tile grid at the given level. Each level should have twice the number of rows of the previous one.

    Parameters

    • level: number

      the level to be queried

    Returns null | number

    the number of tile rows on the specified level

  • Returns the URL for a specific tile.

    Parameters

    • baseURL: string

      the base URL that was passed to the constructor.

    • tile: TileCoordinate

      the coordinate of the tile

    Returns null | string

    the resolved URL for the specified tile or null if the requested tile does not exist.

  • Returns the width, in pixels, of the tiles at the specified detail level. All tiles are assumed to have the same resolution.

    Parameters

    • level: number

      the requested detail level

    Returns null | number

    the width of the tiles at the specified detail level

  • Signals that the underlying data for the tiled images has changed. If this model is added to a map using a RasterTileSetLayer, calling this method will thus trigger a refresh of the visualization.

    Returns void

  • Creates a tileset model for the given layers and options. This is the recommended method to create a model based on information provided by WMTSCapabilities.

    Parameters

    Returns WMTSTileSetModel

    a WMTSTileSetModel for the given parameters.

    Since

    2019.1

  • Creates a tileset model for the given layers and options. This is the recommended method to create a model based on a given WMTS server URL and layer names.

    Parameters

    • url: string

      The URL of the WMTS server.

    • wmtsLayer: WMTSCapabilitiesLayerConfig

      An object literal that defines the desired WMTS layer and (optionally) a style. The literal has a mandatory layer and an optional style property, both of type String.

    • Optional options: WMTSTileSetModelCreateOptions

      The options for the WMTS model

    Returns Promise<WMTSTileSetModel>

    a WMTSTileSetModel for the given parameters. The promise is rejected if the model creation fails.

    Since

    2019.1

Events

"Invalidated" event

  • on("Invalidated", callback: ((...args) => void), context?: any) : Handle
  • An event indicating that this RasterTileSetModel is invalidated. Invalidated means that the underlying data for the tiled images has changed This event fires when invalidate is called. "Invalidated"

    Parameters

    • event: "Invalidated"
    • callback: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns Handle