new VectorTileLayer(url, options)
engineExtensions/layer/VectorTileLayer.js, line 6
矢量瓦片服务接入类
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
url |
String |
服务基地址 |
||||||||||||||||||||||||||||||||||||||||
options |
Object |
额外构造参数
|
Example
// ES5引入方式
const { IGSVectorTileLayer } = zondy.Layer
const { initializeCRS, initializeOptions } = zondy.leaflet.util
// ES6引入方式
import { IGSVectorTileLayer } from "@mapgis/webclient-common"
import { initializeCRS, initializeOptions } from "@mapgis/webclient-leaflet-plugin"
// 构造一个IGSVectorTileLayer图层对象
const layer = new IGSVectorTileLayer({
// 服务基地址
url: "http://{ip}:{port}/igs/rest/services/{服务名}/VectorTileServer"
});
// 加载图层元数据
layer.load().then(function () {
// 构造地图视图的初始化参数
const crs = initializeCRS(layer)
const mapViewOptions = {
// 地图视图参考系
crs: crs,
// 初始化中心点
center: [31.147781205532336,112.21905099757561],
// 初始化级数
zoom: 7
}
// 构造Leaflet地图视图对象
const map = L.map('地图视图容器ID', mapViewOptions)
// 构造图层的初始化参数
const layerOptions = initializeOptions(layer)
// 添加图层到地图视图中
new zondy.leaflet.layer.VectorTileLayer(layerOptions).addTo(map)
})