Class: OGCVectorTile

ol/source/OGCVectorTile~OGCVectorTile


import OGCVectorTile from 'ol/source/OGCVectorTile.js';

来自提供“vector”类型瓦片的 OGC API - Tiles 服务的地图瓦片图层数据源。服务必须至少符合核心(http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/core)和瓦片集(http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset)一致性类。要支持 collections 选项,服务必须符合集合选择(http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/collections-selection)一致性类。

矢量瓦片集可能有多种格式(如 GeoJSON、MVT)。format 选项用于确定使用哪种公布的媒体类型。如果需要强制使用特定媒体类型,可以提供 mediaType 选项。

new OGCVectorTile(options)

Name Type Description
url string

OGC Vector Tileset 端点的 URL。

context Object | undefined

在瓦片 URL 模板中使用的值查找表。URL 中的 {tileMatrix}(缩放级别)、{tileRow}{tileCol} 变量将始终由数据源提供。

format 要素Format<要素Type> | undefined

瓦片的要素格式。默认使用并要求提供。

mediaType string | undefined

瓦片的内容类型(如 "application/vnd.mapbox-vector-tile")。如果未提供,数据源将尝试找到使用配置格式支持的矢量类型的 rel="item" 链接。

attributions AttributionLike | undefined

归属信息。

attributionsCollapsible boolean (defaults to true)

归属信息是否可折叠。

cacheSize number | undefined

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

overlaps boolean (defaults to true)

此数据源可能有重叠的几何图形。将此设置为 false(例如对于表示行政边界多边形的数据源或 TopoJSON 数据源)允许渲染器优化填充和描边操作。

projection ProjectionLike (defaults to 'EPSG:3857')

瓦片网格的投影。

tileClass Class<VectorTile> | undefined

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

transition number | undefined

瓦片不透明度过渡的持续时间(毫秒)。持续时间为 0 将禁用不透明度过渡。

wrapX boolean (defaults to true)

是否水平环绕世界。设置为 false 时,仅渲染一个世界。设置为 true 时,瓦片将水平包裹以渲染多个世界。

zDirection number | NearestDirection函数 (defaults to 1)

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

collections Array.<string> | undefined

要包含的地理空间数据子资源列表。如果未提供,将包含整个数据集。此选项不适用于请求单个集合的瓦片集。

触发事件:

Extends

Methods

增加修订计数器并分发 'change' 事件。

移除数据源中所有缓存的重投影瓦片。下一个渲染周期将创建新的瓦片。

dispatchEvent(event){boolean | undefined} inherited

分发事件并调用所有监听此类型事件的监听器。事件参数可以是一个字符串或一个 具有 type 属性的对象。

Name Type Description
event BaseEvent | string

事件对象。

返回值:
如果有人在事件对象上调用了 preventDefault 或任何监听器返回 false,则返回 false

获取一个值。

Name Type Description
key string

键名。

返回值:
值。

获取数据源的归属函数。

返回值:
Attribution function.

getAttributionsCollapsible(){boolean} inherited

返回值:
归属信息是否可折叠。

getKeys(){Array.<string>} inherited

获取对象属性名列表。

返回值:
属性名列表。

getProjection(){Projection | null} inherited

获取数据源的投影。

返回值:
投影。

getProperties(){NoInfer.<Properties>} inherited

获取包含所有属性名和值的对象。

返回值:
对象。

getRevision(){number} inherited

获取此对象的版本号。 每次对象被修改时,其版本号将递增。

返回值:
版本号。

获取数据源的状态,可能的状态参见 State。

返回值:
状态。

getTileGrid(){TileGrid | null} inherited

返回瓦片数据源的瓦片网格。

返回值:
瓦片网格。

已弃用。 请改用 ImageTile 数据源。 返回数据源的瓦片加载函数。

返回值:
TileLoad函数

已弃用。 请改用 ImageTile 数据源。 返回数据源的瓦片 URL 函数。

返回值:
TileUrl函数

getUrls(){!Array.<string> | null} inherited

已弃用。 请改用 ImageTile 数据源。 返回此数据源使用的 URL。 当使用 tileUrl函数 时ad of url or urls, null will be returned.

返回值:
URL 列表。

on(type, listener){EventsKey | Array<EventsKey>} inherited

监听特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

返回值:
监听器的唯一键。如果第一个参数是事件类型数组,则返回键的数组。

once(type, listener){EventsKey | Array<EventsKey>} inherited

仅监听一次特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

返回值:
监听器的唯一键。如果第一个参数是事件类型数组,则返回键的数组。

set(key, value, silent) inherited

设置一个值。

Name Type Description
key string

键名。

value *

值。

silent boolean | undefined

更新但不触发事件。

setAttributions(attributions) inherited

设置数据源的归属信息。

Name Type Description
attributions AttributionLike | undefined

归属信息。可以作为字符串、Array<string>、Attribution 或 undefined 传入。

setProperties(values, silent) inherited

设置一组键值对。 注意,这会更改任何现有属性并添加新属性(不会移除任何现有属性)。

Name Type Description
values Partial.<NoInfer.<Properties>>

值。

silent boolean | undefined

更新但不触发事件。

setTileLoad函数(tileLoad函数) inherited

已弃用。 请改用 ImageTile 数据源。 设置数据源的瓦片加载函数。

Name Type Description
tileLoad函数 Load函数

瓦片加载函数。

setTileUrl函数(tileUrl函数, key) inherited

已弃用。 请改用 ImageTile 数据源。 设置数据源的瓦片 URL 函数。

Name Type Description
tileUrl函数 Url函数

瓦片 URL 函数。

key string | undefined

数据源的可选新瓦片键。

设置用于请求的 URL。

Name Type Description
url string

URL.

已弃用。 请改用 ImageTile 数据源。 设置用于请求的 URL。

Name Type Description
urls Array.<string>

URL 列表。

un(type, listener) inherited

取消监听特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

unset(key, silent) inherited

取消设置一个属性。

Name Type Description
key string

键名。

silent boolean | undefined

取消设置但不触发事件。