模块:ol/source/WMTS

ol/source/WMTS


WMTS

函数

optionsFromCapabilities(wmtsCap, config){Options | null}

import {optionsFromCapabilities} from 'ol/source/WMTS';

从能力对象生成数据源选项。

Name Type 描述
wmtsCap Object

用于表示能力文档的对象。

config Object

图层的配置属性。若未提供,则使用图层的默认值。

必填配置项:

  • 图层 - {string} 图层标识符。

可选配置属性:

  • matrixSet - {string} 矩阵集标识符,当图层能力中存在多个矩阵集时为必填项。
  • 投影 - {string} 未指定矩阵集时所需的坐标参考系统。例如:“EPSG:3857”。如果所需的坐标参考系统不可用,则会抛出错误。
  • requestEncoding - {string} 图层的 URL 编码格式,默认值为 GetCapabilities 响应中的首个图块 URL 格式。
  • style - {string} 样式名称
  • format - {string} 图层的图像格式。默认值为 GetCapabilities 响应中返回的第一个格式。
  • crossOrigin 属性,类型为 {string|null|undefined},表示跨域。默认值:undefined
返回:
如果未找到图层,则使用WMTS源选项对象或null

类型定义

Options{Object}

属性:
Name Type 描述
attributions AttributionLike | undefined

版权信息。

attributionsCollapsible boolean
(defaults to true)

版权信息可折叠。

cacheSize number | undefined

已弃用。请改用图层上的 cacheSize 选项。

crossOrigin null | string | undefined

crossOrigin 表示已加载图像的属性。请注意,您必须提供 crossOrigin。若需使用 Canvas 渲染器访问像素数据,请使用该值。参见像素数据(https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image)以了解更多详情。

interpolate boolean
(defaults to true)

重采样时默认使用线性插值;若设置为 false,则改用最近邻插值。

tileGrid WMTSTileGrid

瓦片 网格.

projection ProjectionLike | undefined

投影默认为视图投影。

reprojectionErrorThreshold number
(defaults to 0.5)

最大允许重投影误差(像素)。较高的设置值可提升重投影性能,但会降低精度。

requestEncoding RequestEncoding
(defaults to 'KVP')

请求编码。

layer string

WMTS能力中公布的图层名称。

style string

WMTS能力中定义的样式名称。

tileClass Class<ImageTile> | undefined

用于实例化图像瓦片的类。默认为ImageTile.

tilePixelRatio number
(defaults to 1)

切片服务所使用的像素比。例如,如果切片服务声明提供 256x256 像素的切片,但实际发送 512x512 像素的图像(针对视网膜或高DPI设备),则tilePixelRatio应设置为2.

format string
(defaults to 'image/jpeg')

图像格式。仅在下述条件下使用。requestEncoding'KVP'.

version string
(defaults to '1.0.0')

WMTS版本

matrixSet string

矩阵集合

dimensions Object | undefined

瓦片请求的附加维度。这是一个属性命名类似于所声明WMTS维度的对象。

url string | undefined

服务URL。对于RESTful请求编码,这是一个URL模板;对于KVP编码,它是一个普通URL。{?-?}模板模式,例如subdomain{a-f}.domain.com, 可以用来代替在...中分别定义每个urls选项

tileLoadFunction LoadFunction | undefined

用于加载指定 URL 的瓦片的可选函数。默认为

function(imageTile, src) {
  imageTile.getImage().src = src;
};
urls Array.<string> | undefined

URL数组。请求将在此数组中的URL之间进行分配。

wrapX boolean
(defaults to false)

是否水平环绕世界?

transition number | undefined

渲染时透明度过渡的持续时间。要禁用透明度过渡,请传递transition: 0.

zDirection number | NearestDirectionFunction
(defaults to 0)

在整数缩放级别之间,选择是否使用更高或更低缩放级别的瓦片。参见getZForResolution.

RequestEncoding{'KVP'} {'REST'}

请求编码:'KVP' 或 'REST' 之一。