<MapboxGL.VectorSource />
VectorSource is a map content source that supplies tiled vector data in Mapbox Vector Tile format to be shown on the map.
The location of and metadata about the tiles are defined either by an option dictionary or by an external file that conforms to the TileJSON specification.
VectorSource是一个地图内容源,它以Mapbox矢量切片格式提供要在地图上显示的矢量切片数据。
切片的位置和有关切片的元数据由选项字典或符合TileJSON规范的外部文件定义。
props
Prop | Type | Default | Required |
---|---|---|---|
id | string |
MapboxGL.StyleSource.DefaultSourceID |
false |
A string that uniquely identifies the source.
唯一标识源的字符串。
url | string |
none |
false |
---|
A URL to a TileJSON configuration file describing the source’s contents and other metadata.
描述源内容和其他元数据的TileJSON配置文件的URL。
tileUrlTemplates | array |
none |
false |
---|
An array of tile URL templates. If multiple endpoints are specified, clients may use any combination of endpoints.
Example: https://example.com/vector-tiles/{z}/{x}/{y}.pbf
平铺URL模板的数组。如果指定了多个终结点,则客户端可以使用终结点的任意组合。
示例:https://example.com/vector-tile/{z}/{x}/{y}.pbf
minZoomLevel | number |
none |
false |
---|
An unsigned integer that specifies the minimum zoom level at which to display tiles from the source.
The value should be between 0 and 22, inclusive, and less than
maxZoomLevel, if specified. The default value for this option is 0.
一个无符号整数,它指定显示源中的平铺的最小缩放级别。
该值应介于0和22之间(包括0和22),并且小于maxZoomLevel(如果指定)。
此选项的默认值为0。
maxZoomLevel | number |
none |
false |
---|
An unsigned integer that specifies the maximum zoom level at which to display tiles from the source.
The value should be between 0 and 22, inclusive, and less than
minZoomLevel, if specified. The default value for this option is 22.
一个无符号整数,它指定显示源中的平铺的最大缩放级别。该值应介于0和22之间(包括0和22),并且小于minZoomLevel(如果指定)。此选项的默认值为22。
tms | bool |
none |
false |
---|
Influences the y direction of the tile coordinates. (tms inverts y axis)
attribution | string |
none |
false |
---|
An HTML or literal text string defining the buttons to be displayed in an action sheet when the source is part of a map view’s style and the map view’s attribution button is pressed.
HTML或文字文本字符串,用于定义源是地图视图样式的一部分并且按下地图视图的属性按钮时要在操作表中显示的按钮。
onPress | func |
none |
false |
---|
Source press listener, gets called when a user presses one of the children layers only if that layer has a higher z-index than another source layers
Source Press Listener,当用户按下子图层之一时,仅当该图层具有比另一个源图层更高的z索引时才会调用
hitbox | shape |
none |
false |
---|
Overrides the default touch hitbox(44x44 pixels) for the source layers
覆盖源层的默认触摸Hitbox(44x44像素
width | number |
none |
true |
---|
--
height | number |
none |
true |
---|
--
methods
features([layerIDs][, filter])
Returns all features that match the query parameters regardless of whether or not the feature is currently rendered on the map. The domain of the query includes all currently-loaded vector tiles and GeoJSON source tiles. This function does not check tiles outside of the visible viewport.
返回与查询参数匹配的所有要素,而不管该要素当前是否在地图上呈现。查询的域包括所有当前加载的矢量分片和GeoJSON源分片。此函数不检查可见视口外部的平铺。
。
arguments
Name | Type | Required | Description |
---|---|---|---|
layerIDs |
Array |
No |
A set of strings that correspond to the names of layers defined in the current style. Only the features contained in these layers are included in the returned array 与当前样式中定义的图层名称相对应的一组字符串。返回的数组中只包含这些层中包含的要素。 |
filter |
Array |
No |
an optional filter statement to filter the returned Features. 可选的筛选语句,用于筛选返回的功能。 |
vectorSource.features(['id1', 'id2'])
网友评论