/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for * full list of contributors). Published under the 2-clause BSD license. * See license.txt in the OpenLayers distribution or repository for the * full text of the license. */ /** * @requires OpenLayers/Layer/Grid.js */ /** * Class: 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.WMTS = OpenLayers.Class(OpenLayers.Layer.Grid, { /** * APIProperty: isBaseLayer * {Boolean} The layer will be considered a base layer. Default is true. */ isBaseLayer: true, /** * Property: version * {String} WMTS version. Default is "1.0.0". */ version: "1.0.0", /** * APIProperty: requestEncoding * {String} Request encoding. Can be "REST" or "KVP". Default is "KVP". */ requestEncoding: "KVP", /** * APIProperty: 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 . */ url: null, /** * APIProperty: layer * {String} The layer identifier advertised by the WMTS service. Must be * provided. */ layer: null, /** * APIProperty: matrixSet * {String} One of the advertised matrix set identifiers. Must be provided. */ matrixSet: null, /** * APIProperty: style * {String} One of the advertised layer styles. Must be provided. */ style: null, /** * APIProperty: format * {String} The image MIME type. Default is "image/jpeg". */ format: "image/jpeg", /** * APIProperty: tileOrigin * {} The top-left corner of the tile matrix in map * units. If the tile origin for each matrix in a set is different, * the should include a topLeftCorner property. If * not provided, the tile origin will default to the top left corner * of the layer . */ tileOrigin: null, /** * APIProperty: tileFullExtent * {} The full extent of the tile set. If not supplied, * the layer's property will be used. */ tileFullExtent: null, /** * APIProperty: 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 property. */ formatSuffix: null, /** * APIProperty: 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 - {} The top left corner of the * matrix. Must be provided if different than the layer . * tileWidth - {Number} The tile width for the matrix. Must be provided * if different than the width given in the layer . * tileHeight - {Number} The tile height for the matrix. Must be provided * if different than the height given in the layer . */ matrixIds: null, /** * APIProperty: dimensions * {Array} For RESTful request encoding, extra dimensions may be specified. * Items in this list should be property names in the object. * Values of extra dimensions will be determined from the corresponding * values in the object. */ dimensions: null, /** * APIProperty: params * {Object} Extra parameters to include in tile requests. For KVP * , these properties will be encoded in the request * query string. For REST , these properties will * become part of the request path, with order determined by the * list. */ params: null, /** * APIProperty: 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 property. Defaults to 0 (no zoom offset). */ zoomOffset: 0, /** * APIProperty: 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) can include * resolutions that the server supports and that you don't want to * provide with this layer; you can also look at , which is * an alternative to for that specific purpose. * (b) The map can work with resolutions that aren't supported by * the server, i.e. that aren't in . 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. */ serverResolutions: null, /** * Property: formatSuffixMap * {Object} a map between WMTS 'format' request parameter and tile image file suffix */ formatSuffixMap: { "image/png": "png", "image/png8": "png", "image/png24": "png", "image/png32": "png", "png": "png", "image/jpeg": "jpg", "image/jpg": "jpg", "jpeg": "jpg", "jpg": "jpg" }, /** * Property: matrix * {Object} Matrix definition for the current map resolution. Updated by * the method. */ matrix: null, /** * Constructor: OpenLayers.Layer.WMTS * Create a new WMTS layer. * * Example: * (code) * var wmts = new OpenLayers.Layer.WMTS({ * name: "My WMTS Layer", * url: "http://example.com/wmts", * layer: "layer_id", * style: "default", * matrixSet: "matrix_id" * }); * (end) * * Parameters: * config - {Object} Configuration properties for the layer. * * Required configuration properties: * url - {String} The base url for the service. See the property. * layer - {String} The layer identifier. See the property. * style - {String} The layer style identifier. See the