# OpenLayers.Layer.WMTS

Instances of the WMTS class allow viewing of tiles from a service that implements the OGC WMTS specification version 1.0.0.

#### Inherits from

- OpenLayers.Layer.Grid

Summary

OpenLayers.Layer.WMTS | Instances of the WMTS class allow viewing of tiles from a service that implements the OGC WMTS specification version 1.0.0.
Properties |
isBaseLayer | {Boolean} The layer will be considered a base layer.
requestEncoding | {String} Request encoding.
url | {String|Array(String)} The base URL or request URL template for the WMTS service.
layer | {String} The layer identifier advertised by the WMTS service.
matrixSet | {String} One of the advertised matrix set identifiers.
style | {String} One of the advertised layer styles.
format | {String} The image MIME type.
tileOrigin | {OpenLayers.LonLat} The top-left corner of the tile matrix in map units.
tileFullExtent | {OpenLayers.Bounds} The full extent of the tile set.
formatSuffix | {String} For REST request encoding, an image format suffix must be included in the request.
matrixIds | {Array} A list of tile matrix identifiers.
dimensions | {Array} For RESTful request encoding, extra dimensions may be specified.
params | {Object} Extra parameters to include in tile requests.
zoomOffset | {Number} If your cache has more levels than you want to provide access to with this layer, supply a zoomOffset.
serverResolutions | {Array} A list of all resolutions available on the server.
Constructor |
OpenLayers.Layer.WMTS | Create a new WMTS layer.
Functions |
clone |
mergeNewParams | Extend the existing layer params with new properties.

### Properties

### isBaseLayer

{Boolean} The layer will be considered a base layer. Default is true.

### requestEncoding

{String} Request encoding. Can be “REST” or “KVP”. Default is “KVP”.

### url

{String|Array(String)} The base URL or request URL template for the WMTS service. Must be provided. Array is only supported for base URLs, not for request URL templates. URL templates are only supported for REST requestEncoding.

### layer

{String} The layer identifier advertised by the WMTS service. Must be provided.

### matrixSet

{String} One of the advertised matrix set identifiers. Must be provided.

### style

{String} One of the advertised layer styles. Must be provided.

### format

{String} The image MIME type. Default is “image/jpeg”.

### tileOrigin

{OpenLayers.LonLat} The top-left corner of the tile matrix in map units. If the tile origin for each matrix in a set is different, the matrixIds should include a topLeftCorner property. If not provided, the tile origin will default to the top left corner of the layer maxExtent.

### tileFullExtent

{OpenLayers.Bounds} The full extent of the tile set. If not supplied, the layer’s maxExtent property will be used.

### formatSuffix

{String} For REST request encoding, an image format suffix must be included in the request. If not provided, the suffix will be derived from the format property.

### matrixIds

{Array} A list of tile matrix identifiers. If not provided, the matrix identifiers will be assumed to be integers corresponding to the map zoom level. If a list of strings is provided, each item should be the matrix identifier that corresponds to the map zoom level. Additionally, a list of objects can be provided. Each object should describe the matrix as presented in the WMTS capabilities. These objects should have the propertes shown below.

#### Matrix properties

identifier | {String} The matrix identifier (required).
scaleDenominator | {Number} The matrix scale denominator.
topLeftCorner | {OpenLayers.LonLat} The top left corner of the matrix. Must be provided if different than the layer tileOrigin.
tileWidth | {Number} The tile width for the matrix. Must be provided if different than the width given in the layer tileSize.
tileHeight | {Number} The tile height for the matrix. Must be provided if different than the height given in the layer tileSize.

### dimensions

{Array} For RESTful request encoding, extra dimensions may be specified. Items in this list should be property names in the params object. Values of extra dimensions will be determined from the corresponding values in the params object.

### params

{Object} Extra parameters to include in tile requests. For KVP requestEncoding, these properties will be encoded in the request query string. For REST requestEncoding, these properties will become part of the request path, with order determined by the dimensions list.

### zoomOffset

{Number} If your cache has more levels than you want to provide access to with this layer, supply a zoomOffset. This zoom offset is added to the current map zoom level to determine the level for a requested tile. For example, if you supply a zoomOffset of 3, when the map is at the zoom 0, tiles will be requested from level 3 of your cache. Default is 0 (assumes cache level and map zoom are equivalent). Additionally, if this layer is to be used as an overlay and the cache has fewer zoom levels than the base layer, you can supply a negative zoomOffset. For example, if a map zoom level of 1 corresponds to your cache level zero, you would supply a -1 zoomOffset (and set the maxResolution of the layer appropriately). The zoomOffset value has no effect if complete matrix definitions (including scaleDenominator) are supplied in the matrixIds property. Defaults to 0 (no zoom offset).

### serverResolutions

{Array} A list of all resolutions available on the server. Only set this property if the map resolutions differ from the server. This property serves two purposes. (a) serverResolutions can include resolutions that the server supports and that you don’t want to provide with this layer; you can also look at zoomOffset, which is an alternative to serverResolutions for that specific purpose. (b) The map can work with resolutions that aren’t supported by the server, i.e. that aren’t in serverResolutions. When the map is displayed in such a resolution data for the closest server-supported resolution is loaded and the layer div is stretched as necessary.

### Constructor

### OpenLayers.Layer.WMTS

Create a new WMTS layer.

#### Example

>     var wmts = new OpenLayers.Layer.WMTS({
>         name: "My WMTS Layer",
>         url: "http://example.com/wmts",
>         layer: "layer_id",
>         style: "default",
>         matrixSet: "matrix_id"
>     });

#### Parameters

config | {Object} Configuration properties for the layer.

#### Required configuration properties

url | {String} The base url for the service. See the url property.
layer | {String} The layer identifier. See the layer property.
style | {String} The layer style identifier. See the style property.
matrixSet | {String} The tile matrix set identifier. See the matrixSet property.

Any other documented layer properties can be provided in the config object.

### Functions

### clone

> clone: function( | obj | )

#### Parameters

obj | {Object}

#### Returns

{OpenLayers.Layer.WMTS} An exact clone of this OpenLayers.Layer.WMTS

### mergeNewParams

> mergeNewParams: function( | newParams | )

Extend the existing layer params with new properties. Tiles will be reloaded with updated params in the request.

#### Parameters

newParams | {Object} Properties to extend to existing params.

This class represents a longitude and latitude pair
Instances of this class represent bounding boxes.

> clone: function( | obj | )

> mergeNewParams: function( | newParams | )

Extend the existing layer params with new properties.
{Object} Extra parameters to include in tile requests.
{String} Request encoding.
{Array} A list of tile matrix identifiers.
{<OpenLayers.Bounds>|Array} If provided as an array, the array should consist of four values (left, bottom, right, top).
{String} The image MIME type.
{OpenLayers.LonLat} The top-left corner of the tile matrix in map units.
{OpenLayers.Size} This size of each tile.
{Array} For RESTful request encoding, extra dimensions may be specified.
{Array} A list of all resolutions available on the server.
{Number} If your cache has more levels than you want to provide access to with this layer, supply a zoomOffset.
{String|Array(String)} The base URL or request URL template for the WMTS service.
{String} The layer identifier advertised by the WMTS service.
{String} One of the advertised layer styles.
{String} One of the advertised matrix set identifiers.
Create a new WMTS layer.
Close