Class: TiledVectorLayer

TiledVectorLayer

SuperMap iServer 的矢量瓦片图层。矢量瓦片是将矢量数据通过不同的描述文件来组织和定义,在客户端实时解析数据并完成绘制。 矢量瓦片体积小,可高度压缩,数据传输体量小,地图更新的代价小,常用于存储用于查询、变更频繁的矢量图层, 适合于地图中对时效性要求较高的地物要素的表达,如 POI 信息、路线信息等。

new TiledVectorLayer(url, options)

Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/leaflet/iclient-leaflet.js"></script>
<script>
  new L.supermap.TiledVectorLayer(url, options);
  
  // 弃用的写法
  L.supermap.tiledVectorLayer(url, options);
  
</script>

// ES6 Import
import { TiledVectorLayer } from '@supermap/iclient-leaflet';

new TiledVectorLayer(url, options);

leaflet/overlay/TiledVectorLayer.js, line 17
Name Type Description
url string

服务地址。

options Object

参数。

Name Type Default Description
layerNames string

指定图层的名称列表,支持的类型为矢量图层。

layersID string

获取进行切片的地图图层 ID。

cartoCSS string 可选

客户端 CartoCSS 样式字符串。

serverCartoCSSStyle boolean true 可选

是否使用服务端 CartoCSS 样式。

processCharacters boolean false 可选

设置客户端 CartoCSS 样式时是否进行特定字符转换。

crs CRS 可选

坐标系统类。

returnAttributes boolean false 可选

是否返回 attributes。

expands string 可选

图层扩展的像素值。

cacheEnabled boolean true 可选

是否启用缓存。

tileTemplate Object 可选

瓦片模板,如果设置了此参数,则按此模板出图。默认出图方式为 URL 对接的第三方瓦片。

subdomains string 可选

子域名。

timeout number 10000 可选

延时。

attribution string 'Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>` 可选

版权描述信息。

Example
new TiledVectorLayer(url).addTo(map);

Extends

Methods

inherited getDataLayerNames(){Array}

leaflet/overlay/vectortile/VectorGrid.js, line 159

获取数据图层名称。

Returns:
Type Description
Array 返回数据图层名称数组。

getLayerStyleInfo(layerName)

leaflet/overlay/TiledVectorLayer.js, line 151

获取图层样式信息。

Name Type Description
layerName string

图层名称。

getScale(zoom){number}

leaflet/overlay/TiledVectorLayer.js, line 310

通过缩放级别获取比例尺。

Name Type Description
zoom number

缩放级别。

Returns:
Type Description
number 比例尺。

getScaleFromCoords(coords){number}

leaflet/overlay/TiledVectorLayer.js, line 323

通过行列号获取比例尺。

Name Type Description
coords Object

行列号。

Returns:
Type Description
number 比例尺。

inherited getStyle(layerName){Object}

leaflet/overlay/vectortile/VectorGrid.js, line 102

获取指定图层样式。

Name Type Description
layerName string

图层名称。

Returns:
Type Description
Object 指定图层的样式。

inherited getStyles(){Object}

leaflet/overlay/vectortile/VectorGrid.js, line 93

获取图层样式。

Returns:
Type Description
Object 所有图层的样式。

inherited resetFeatureStyle(id, layerName){VectorGrid}

leaflet/overlay/vectortile/VectorGrid.js, line 136

指定要素 ID 和图层名称重绘要素风格。

Name Type Description
id number

要素 ID。

layerName string

图层名称。

Returns:
Type Description
VectorGrid VectorGrid 的实例对象。

setClientCartoCSS()

leaflet/overlay/TiledVectorLayer.js, line 236

客户端设置 cartoCSS 样式。

inherited setFeatureStyle(id, layerName, layerStyle){VectorGrid}

leaflet/overlay/vectortile/VectorGrid.js, line 112

指定要素 ID 和图层名称设置要素风格。

Name Type Description
id number

要素 ID。

layerName string

图层名称。

layerStyle Array | function

图层样式。

Returns:
Type Description
VectorGrid VectorGrid 的实例对象。