Class: MapVLayer

MapVLayer

MapV 图层类。MapV 是一款地理信息可视化开源库,MapV 图层可以用来展示大量地理信息数据,点、线、面的数据,每种数据也有不同的展示类型,如直接打点、热力图、网格、聚合等方式展示数据。
展示大量的点数据:如热力图、网格、蜂窝状、点聚合、按颜色区间、按半径大小等方式。
展示大量的线数据:如普通画线、高亮叠加、热力线数据展示等方式,适合展示大量轨迹的场景。
展示大量的自定义面数据:按颜色区间来展示,如展示行政区划数据。

new MapVLayer(dataSet, mapVOptions, options)

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

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

new MapVLayer(dataSet, mapVOptions, options);

leaflet/overlay/MapVLayer.js, line 9
Name Type Description
dataSet Mapv.DataSet

MapV 图层数据集。

mapVOptions Object

MapV 图层参数。

options Object

参数。

Name Type Default Description
attributionPrefix string 可选

版权信息前缀。

attribution string '© 2018 百度 MapV' 可选

版权描述信息。

Fires

Extends

Events

loaded

leaflet/overlay/MapVLayer.js, line 64

图层添加完成之后触发。

Methods

addData(data, options)

leaflet/overlay/MapVLayer.js, line 89

添加数据。

Name Type Description
data Object

需要添加的数据。

options Object

参数。

clearData()

leaflet/overlay/MapVLayer.js, line 138

清除数据。

draw()

leaflet/overlay/MapVLayer.js, line 146

绘制图层。

getCanvas(){HTMLElement}

leaflet/overlay/MapVLayer.js, line 171

获取 canvas。

Returns:
Type Description
HTMLElement 返回 mapV 图层包含的 canvas 对象。

getContainer(){HTMLElement}

leaflet/overlay/MapVLayer.js, line 180

获取容器。

Returns:
Type Description
HTMLElement 返回包含 mapV 图层的 dom 对象。

getData(){Mapv.DataSet}

leaflet/overlay/MapVLayer.js, line 110

获取数据。

Returns:
Type Description
Mapv.DataSet mapv 数据集。

getTopLeft(){L.Bounds}

leaflet/overlay/MapVLayer.js, line 189

获取左上角坐标。

Returns:
Type Description
L.Bounds 返回左上角坐标。

removeData(filter)

leaflet/overlay/MapVLayer.js, line 122

删除数据。

Name Type Description
filter function

过滤条件。指定数据项后,返回值为 true,表示删除该元素;否则表示不删除。

Example
filter=function(data){
   if(data.id=="1"){
     return true
   }
   return false;
 }

render()

leaflet/overlay/MapVLayer.js, line 163

渲染。

setZIndex(zIndex)

leaflet/overlay/MapVLayer.js, line 154

设置 canvas 层级。

Name Type Description
zIndex number

canvas 层级。

update(opt, data, options)

leaflet/overlay/MapVLayer.js, line 99

更新图层。

Name Type Description
opt Object

待更新的数据。

data Object

mapv 数据集。

options Object

参数。