---
title: VectorTileSource
source: https://vjmap.com/doc/VectorTileSource.html
---

# VectorTileSource
**扩展事件**


包含`矢量瓦片格式`矢量瓦片的源 ``. （见`样式规范` 有关选项的详细文档。）

### Parameters
- `id` **`string`**
- `options` **任何**
- `dispatcher` **调度员**
- `eventedParent` **`事件发生`**

### Examples
```
map.addSource('some id', {
    type: 'vector',
    url: 'your url'
});
```

```
map.addSource('some id', {
    type: 'vector',
    tiles: ['https://xxx/{z}/{x}/{y}.mvt'],
    minzoom: 6,
    maxzoom: 14
});
```

```
map.getSource('some id').setUrl("your url");
```

```
map.getSource('some id').setTiles(['https://xxx/{z}/{x}/{y}.mvt']);
```

### setTiles
设置源`tiles`属性并重新渲染地图。

#### Parameters
- `tiles` **`Array`&lt; `string`\>**一个或多个图块源 URL 的数组，如 TileJSON 规范中所示。

返回**[VectorTileSource][260]**这个

### setUrl
设置源`url`属性并重新渲染地图。

#### Parameters
- `url` **`string`**TileJSON 资源的 URL。支持的协议是`http:`，`https:`。

返回**[VectorTileSource][260]**这个
