new WebMap(id, options, mapOptions)
Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.js"></script>
<script>
new mapboxgl.supermap.WebMap(id, options, mapOptions);
</script>
// ES6 Import
import { WebMap } from '@supermapgis/iclient-mapboxgl';
new WebMap(id, options, mapOptions);
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
number |
iPortal|Online 地图 ID。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
基础参数。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mapOptions |
Object |
地图参数。
|
- Version:
- 9.1.2
Fires
- WebMap#event:mapinitialized
- WebMap#event:mapcreatesucceeded
- WebMap#event:mapcreatefailed
- WebMap#event:addlayerssucceeded
- WebMap#event:layercreatefailed
- WebMap#event:baidumapnotsupport
- WebMap#event:layerorsourcenameduplicated
- WebMap#event:dataflowfeatureupdated
- WebMap#event:projectionnotmatch
- WebMap#event:mapbeforeremove
- WebMap#event:getmapfailed
- WebMap#event:getlayersfailed
Extends
Events
-
inherited deprecated addlayerssucceeded
common/mapping/WebMapBase.js, line 102 -
地图创建成功。自v11.2.1废弃,请使用
WebMapBase#event:mapcreatesucceeded
替代。Properties:
Name Type Description map
Object MapBoxGL Map 实例。
mapparams
Object 地图信息。
mapParams.title
string 地图标题。
mapParams.description
string 地图描述。
layers
Aarry 图层列表。
-
inherited baidumapnotsupport
common/mapping/WebMapBase.js, line 143 -
不支持百度地图。
-
inherited dataflowfeatureupdated
common/mapping/WebMapBase.js, line 153 -
数据流图层要素更新。
-
inherited deprecated getlayersfailed
common/mapping/WebMapBase.js, line 134 -
图层创建失败。自v11.2.1废弃,请使用
WebMapBase#event:layercreatefailed
替代。Properties:
Name Type Description error
Object 失败原因。
map
Object MapBoxGL Map 实例。
layer
Object 图层信息。
-
inherited deprecated getmapfailed
common/mapping/WebMapBase.js, line 119 -
地图创建失败。自v11.2.1废弃,请使用
WebMapBase#event:mapcreatefailed
替代。Properties:
Name Type Description error
Object 失败原因。
-
inherited layercreatefailed
common/mapping/WebMapBase.js, line 126 -
图层创建失败。
Properties:
Name Type Description error
Object 失败原因。
map
Object MapBoxGL Map 实例。
layer
Object 图层信息。
-
inherited layerorsourcenameduplicated
common/mapping/WebMapBase.js, line 148 -
图层名或数据源名重复。
-
inherited mapbeforeremove
common/mapping/WebMapBase.js, line 165 -
地图销毁前。
-
inherited mapcreatefailed
common/mapping/WebMapBase.js, line 113 -
地图创建失败。
Properties:
Name Type Description error
Object 失败原因。
-
inherited mapcreatesucceeded
common/mapping/WebMapBase.js, line 92 -
地图创建成功。
Properties:
Name Type Description map
Object MapBoxGL Map 实例。
mapparams
Object 地图信息。
mapParams.title
string 地图标题。
mapParams.description
string 地图描述。
layers
Aarry 图层列表。
-
inherited mapinitialized
common/mapping/WebMapBase.js, line 86 -
地图初始化成功。
Properties:
Name Type Description map
Object MapBoxGL Map 实例。
-
inherited projectionnotmatch
common/mapping/WebMapBase.js, line 158 -
底图投影与底图投影不匹配。
Methods
-
inherited clean(removeMap)
common/mapping/WebMapBase.js, line 466 -
删除地图或者清空地图上的图层和事件。
Name Type Default Description removeMap
boolean true 可选 是否删除地图。false 表示只清空地图上的图层和事件。
- Version:
- 11.2.1
-
inherited cleanLayers()
common/mapping/WebMapBase.js, line 487 -
删除追加的图层和事件。当设置
map
时有效- Version:
- 11.2.1
-
inherited copyLayer(id, layerInfo){Array}
common/mapping/WebMapBase.js, line 454 -
复制指定图层。
Name Type Description id
string 指定图层 id。
layerInfo
Object 可选 复制图层信息。如 id、source、layout
- Version:
- 11.2.1
Returns:
Type Description Array 复制成功的信图层信息。 -
inherited getLayerCatalog(){Array}
common/mapping/WebMapBase.js, line 394 -
获取图层组。
- Version:
- 11.2.1
Returns:
Type Description Array 图层组。 -
inherited getLayers(){Array}
common/mapping/WebMapBase.js, line 374 -
获取图层。
- Version:
- 11.2.1
Returns:
Type Description Array 图层。 -
inherited getLegends(){Array}
common/mapping/WebMapBase.js, line 384 -
获取图例。
- Version:
- 11.2.1
Returns:
Type Description Array 图例。 -
inherited getWebMapType(){String}
common/mapping/WebMapBase.js, line 419 -
获取地图类型。
- Version:
- 11.2.1
Returns:
Type Description String 地图类型。 -
inherited rectifyLayersOrder(layers, topLayerBeforeId)
common/mapping/WebMapBase.js, line 429 -
根据已知顺序的可感知图层,对地图上图顺序进行排序。
Name Type Description layers
Array 图层列表。
topLayerBeforeId
string 图层列表中置顶图层指定的 beforeId。
- Version:
- 11.2.1
-
inherited resize(keepBounds)
common/mapping/WebMapBase.js, line 178 -
调整地图大小。
Name Type Default Description keepBounds
boolean false 可选 是否保持当前地图范围。
-
inherited setBearing(pitch)
common/mapping/WebMapBase.js, line 250 -
更新地图旋转角度。
Name Type Description pitch
number 地图旋转角度。
-
inherited setCenter(center)
common/mapping/WebMapBase.js, line 223 -
更新地图中心点。
Name Type Description center
Array 地图中心点。
-
inherited setCRS(crs)
common/mapping/WebMapBase.js, line 196 -
更新地图投影。
Name Type Description crs
string | Object 地图 crs。
-
inherited deprecated setMapOptions(mapOptions)
common/mapping/WebMapBase.js, line 356 -
设置 map 参数。
Name Type Description mapOptions
Object map 参数。
-
inherited setMaxBounds(maxBounds)
common/mapping/WebMapBase.js, line 307 -
更新地图 maxbounds。
Name Type Description maxBounds
number 地图最大缩放范围。
-
inherited setMaxZoom(maxZoom)
common/mapping/WebMapBase.js, line 332 -
更新地图 maxzoom。
Name Type Description maxZoom
number 地图最大缩放级别。
- Version:
- 11.2.1
-
inherited setMinZoom(minZoom)
common/mapping/WebMapBase.js, line 319 -
更新地图 minzoom。
Name Type Description minZoom
number 地图最小缩放级别。
- Version:
- 11.2.1
-
inherited setPitch(pitch)
common/mapping/WebMapBase.js, line 264 -
更新地图倾角。
Name Type Description pitch
number 地图倾角。
-
inherited setRasterTileSize(tileSize)
common/mapping/WebMapBase.js, line 290 -
更新地图栅格图层瓦片大小。
Name Type Description tileSize
number 栅格瓦片大小。
-
inherited setRenderWorldCopies(isWorldCopy)
common/mapping/WebMapBase.js, line 238 -
更新地图连续渲染。
Name Type Description isWorldCopy
boolean 地图是否连续渲染。
-
inherited setStyle(style)
common/mapping/WebMapBase.js, line 278 -
更新地图样式。
Name Type Description style
Object 地图 style 样式
-
inherited deprecated setWebMapOptions(webMapOptions)
common/mapping/WebMapBase.js, line 345 -
设置 webMap 参数。
Name Type Description webMapOptions
Object webMap 参数。
-
inherited toggleLayerVisible(layer, visible)
common/mapping/WebMapBase.js, line 408 -
设置图层显隐。
Name Type Description layer
string 图层信息。
visible
boolean 图层是否可见。true 表示显示,false 表示隐藏。
- Version:
- 11.2.1
-
inherited updateOverlayLayer(layerInfo, features, mergeByField)
common/mapping/WebMapBase.js, line 440 -
更新 geojson 图层要素信息。
Name Type Description layerInfo
Object 图层信息。
Name Type Description id
string 可选 图层信息 id。
renderSource
string 可选 图层渲染 source 信息。
features
Array 要素信息。
mergeByField
string 属性关联字段。
- Version:
- 11.2.1