/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for * full list of contributors). Published under the Clear BSD license. * See http://svn.openlayers.org/trunk/openlayers/license.txt for the * full text of the license. */ /** * @requires OpenLayers/Layer/Grid.js * @requires OpenLayers/Tile/Image.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} The base URL for the WMTS service. Must be provided. */ 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). * 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, /** * 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