ol
Version:
OpenLayers mapping library
276 lines • 9.7 kB
TypeScript
/**
* Generate source options from a capabilities object.
* @param {Object} wmtsCap An object representing the capabilities document.
* @param {!Object} config Configuration properties for the layer. Defaults for
* the layer will apply if not provided.
*
* Required config properties:
* - layer - {string} The layer identifier.
*
* Optional config properties:
* - matrixSet - {string} The matrix set identifier, required if there is
* more than one matrix set in the layer capabilities.
* - projection - {string} The desired CRS when no matrixSet is specified.
* eg: "EPSG:3857". If the desired projection is not available,
* an error is thrown.
* - requestEncoding - {string} url encoding format for the layer. Default is
* the first tile url format found in the GetCapabilities response.
* - style - {string} The name of the style
* - format - {string} Image format for the layer. Default is the first
* format returned in the GetCapabilities response.
* - crossOrigin - {string|null|undefined} Cross origin. Default is `undefined`.
* @return {?Options} WMTS source options object or `null` if the layer was not found.
* @api
*/
export function optionsFromCapabilities(wmtsCap: any, config: any): Options;
export default WMTS;
export type Options = {
/**
* Attributions.
*/
attributions?: string | string[] | ((arg0: import("../PluggableMap.js").FrameState) => string | string[]);
/**
* Tile cache size. The default depends on the screen size. Will be ignored if too small.
*/
cacheSize?: number;
/**
* The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
*/
crossOrigin?: string;
/**
* Tile grid.
*/
tileGrid: import("../tilegrid/WMTS.js").default;
/**
* Projection. Default is the view projection.
*/
projection?: string | import("../proj/Projection.js").default;
/**
* Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
*/
reprojectionErrorThreshold?: number;
/**
* Request encoding.
*/
requestEncoding?: any;
/**
* Layer name as advertised in the WMTS capabilities.
*/
layer: string;
/**
* Style name as advertised in the WMTS capabilities.
*/
style: string;
/**
* Class used to instantiate image tiles. Default is {@link module:ol/ImageTile~ImageTile}.
*/
tileClass?: typeof import("../ImageTile.js").default;
/**
* The pixel ratio used by the tile service.
* For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px
* by 512px images (for retina/hidpi devices) then `tilePixelRatio`
* should be set to `2`.
*/
tilePixelRatio?: number;
/**
* Image format. Only used when `requestEncoding` is `'KVP'`.
*/
format?: string;
/**
* WMTS version.
*/
version?: string;
/**
* Matrix set.
*/
matrixSet: string;
/**
* Additional "dimensions" for tile requests.
* This is an object with properties named like the advertised WMTS dimensions.
*/
dimensions?: any;
/**
* A URL for the service.
* For the RESTful request encoding, this is a URL
* template. For KVP encoding, it is normal URL. A `{?-?}` template pattern,
* for example `subdomain{a-f}.domain.com`, may be used instead of defining
* each one separately in the `urls` option.
*/
url?: string;
/**
* Optional function to load a tile given a URL. The default is
* ```js
* function(imageTile, src) {
* imageTile.getImage().src = src;
* };
* ```
*/
tileLoadFunction?: (arg0: import("../Tile.js").default, arg1: string) => void;
/**
* An array of URLs.
* Requests will be distributed among the URLs in this array.
*/
urls?: string[];
/**
* Whether to wrap the world horizontally.
*/
wrapX?: boolean;
/**
* Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
*/
transition?: number;
};
/**
* @typedef {Object} Options
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
* @property {number} [cacheSize] Tile cache size. The default depends on the screen size. Will be ignored if too small.
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
* @property {import("../tilegrid/WMTS.js").default} tileGrid Tile grid.
* @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
* @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels).
* Higher values can increase reprojection performance, but decrease precision.
* @property {import("./WMTSRequestEncoding.js").default|string} [requestEncoding='KVP'] Request encoding.
* @property {string} layer Layer name as advertised in the WMTS capabilities.
* @property {string} style Style name as advertised in the WMTS capabilities.
* @property {typeof import("../ImageTile.js").default} [tileClass] Class used to instantiate image tiles. Default is {@link module:ol/ImageTile~ImageTile}.
* @property {number} [tilePixelRatio=1] The pixel ratio used by the tile service.
* For example, if the tile service advertizes 256px by 256px tiles but actually sends 512px
* by 512px images (for retina/hidpi devices) then `tilePixelRatio`
* should be set to `2`.
* @property {string} [format='image/jpeg'] Image format. Only used when `requestEncoding` is `'KVP'`.
* @property {string} [version='1.0.0'] WMTS version.
* @property {string} matrixSet Matrix set.
* @property {!Object} [dimensions] Additional "dimensions" for tile requests.
* This is an object with properties named like the advertised WMTS dimensions.
* @property {string} [url] A URL for the service.
* For the RESTful request encoding, this is a URL
* template. For KVP encoding, it is normal URL. A `{?-?}` template pattern,
* for example `subdomain{a-f}.domain.com`, may be used instead of defining
* each one separately in the `urls` option.
* @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. The default is
* ```js
* function(imageTile, src) {
* imageTile.getImage().src = src;
* };
* ```
* @property {Array<string>} [urls] An array of URLs.
* Requests will be distributed among the URLs in this array.
* @property {boolean} [wrapX=false] Whether to wrap the world horizontally.
* @property {number} [transition] Duration of the opacity transition for rendering.
* To disable the opacity transition, pass `transition: 0`.
*/
/**
* @classdesc
* Layer source for tile data from WMTS servers.
* @api
*/
declare class WMTS extends TileImage {
/**
* @param {Options} options WMTS options.
*/
constructor(options: Options);
/**
* @private
* @type {string}
*/
private version_;
/**
* @private
* @type {string}
*/
private format_;
/**
* @private
* @type {!Object}
*/
private dimensions_;
/**
* @private
* @type {string}
*/
private layer_;
/**
* @private
* @type {string}
*/
private matrixSet_;
/**
* @private
* @type {string}
*/
private style_;
/**
* @private
* @type {import("./WMTSRequestEncoding.js").default}
*/
private requestEncoding_;
/**
* Set the URLs to use for requests.
* URLs may contain OGC conform URL Template Variables: {TileMatrix}, {TileRow}, {TileCol}.
* @override
*/
setUrls(urls: any): void;
/**
* Get the dimensions, i.e. those passed to the constructor through the
* "dimensions" option, and possibly updated using the updateDimensions
* method.
* @return {!Object} Dimensions.
* @api
*/
getDimensions(): any;
/**
* Return the image format of the WMTS source.
* @return {string} Format.
* @api
*/
getFormat(): string;
/**
* Return the layer of the WMTS source.
* @return {string} Layer.
* @api
*/
getLayer(): string;
/**
* Return the matrix set of the WMTS source.
* @return {string} MatrixSet.
* @api
*/
getMatrixSet(): string;
/**
* Return the request encoding, either "KVP" or "REST".
* @return {import("./WMTSRequestEncoding.js").default} Request encoding.
* @api
*/
getRequestEncoding(): any;
/**
* Return the style of the WMTS source.
* @return {string} Style.
* @api
*/
getStyle(): string;
/**
* Return the version of the WMTS source.
* @return {string} Version.
* @api
*/
getVersion(): string;
/**
* @private
* @return {string} The key for the current dimensions.
*/
private getKeyForDimensions_;
/**
* Update the dimensions.
* @param {Object} dimensions Dimensions.
* @api
*/
updateDimensions(dimensions: any): void;
}
import TileImage from "./TileImage.js";
//# sourceMappingURL=WMTS.d.ts.map