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:xyztilelayernotsupport
- WebMap#event:getmapfailed
- WebMap#event:getlayersfailed
Extends
Events
-
inherited deprecated addlayerssucceeded
common/mapping/WebMapBase.js, line 103 -
地图创建成功。自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 144 -
不支持百度地图。
-
inherited dataflowfeatureupdated
common/mapping/WebMapBase.js, line 154 -
数据流图层要素更新。
-
inherited deprecated getlayersfailed
common/mapping/WebMapBase.js, line 135 -
图层创建失败。自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 120 -
地图创建失败。自v11.2.1废弃,请使用
WebMapBase#event:mapcreatefailed
替代。Properties:
Name Type Description error
Object 失败原因。
-
inherited layercreatefailed
common/mapping/WebMapBase.js, line 127 -
图层创建失败。
Properties:
Name Type Description error
Object 失败原因。
map
Object MapBoxGL Map 实例。
layer
Object 图层信息。
-
inherited layerorsourcenameduplicated
common/mapping/WebMapBase.js, line 149 -
图层名或数据源名重复。
-
inherited mapbeforeremove
common/mapping/WebMapBase.js, line 171 -
地图销毁前。
-
inherited mapcreatefailed
common/mapping/WebMapBase.js, line 114 -
地图创建失败。
Properties:
Name Type Description error
Object 失败原因。
-
inherited mapcreatesucceeded
common/mapping/WebMapBase.js, line 93 -
地图创建成功。
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 87 -
地图初始化成功。
Properties:
Name Type Description map
Object MapBoxGL Map 实例。
-
inherited projectionnotmatch
common/mapping/WebMapBase.js, line 159 -
底图投影与底图投影不匹配。
-
inherited xyztilelayernotsupport
common/mapping/WebMapBase.js, line 164 -
XYZ TILE图层与底图的分辨率或原点不匹配。
Methods
-
inherited clean(removeMap)
common/mapping/WebMapBase.js, line 452 -
删除地图或者清空地图上的图层和事件。
Name Type Default Description removeMap
boolean true 可选 是否删除地图。false 表示只清空地图上的图层和事件。
- Version:
- 11.2.1
-
inherited cleanLayers()
common/mapping/WebMapBase.js, line 473 -
删除追加的图层和事件。当设置
map
时有效- Version:
- 11.2.1
-
inherited copyLayer(id, layerInfo){Array}
common/mapping/WebMapBase.js, line 440 -
复制指定图层。
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 380 -
获取图层组。
- Version:
- 11.2.1
Returns:
Type Description Array 图层组。 -
inherited getLayers(){Array}
common/mapping/WebMapBase.js, line 360 -
获取图层。
- Version:
- 11.2.1
Returns:
Type Description Array 图层。 -
inherited getLegends(){Array}
common/mapping/WebMapBase.js, line 370 -
获取图例。
- Version:
- 11.2.1
Returns:
Type Description Array 图例。 -
inherited getWebMapType(){String}
common/mapping/WebMapBase.js, line 405 -
获取地图类型。
- Version:
- 11.2.1
Returns:
Type Description String 地图类型。 -
inherited rectifyLayersOrder(layers, topLayerBeforeId)
common/mapping/WebMapBase.js, line 415 -
根据已知顺序的可感知图层,对地图上图顺序进行排序。
Name Type Description layers
Array 图层列表。
topLayerBeforeId
string 图层列表中置顶图层指定的 beforeId。
- Version:
- 11.2.1
-
inherited resize(keepBounds)
common/mapping/WebMapBase.js, line 183 -
调整地图大小。
Name Type Default Description keepBounds
boolean false 可选 是否保持当前地图范围。
-
inherited setBearing(pitch)
common/mapping/WebMapBase.js, line 228 -
更新地图旋转角度。
Name Type Description pitch
number 地图旋转角度。
-
inherited setCenter(center)
common/mapping/WebMapBase.js, line 201 -
更新地图中心点。
Name Type Description center
Array 地图中心点。
-
setCRS(crs)
mapboxgl/mapping/WebMap.js, line 93 -
更新地图投影。
Name Type Description crs
string | Object 地图 crs。
-
inherited deprecated setMapOptions(mapOptions)
common/mapping/WebMapBase.js, line 342 -
设置 map 参数。
Name Type Description mapOptions
Object map 参数。
-
inherited setMaxBounds(maxBounds)
common/mapping/WebMapBase.js, line 293 -
更新地图 maxbounds。
Name Type Description maxBounds
number 地图最大缩放范围。
-
inherited setMaxZoom(maxZoom)
common/mapping/WebMapBase.js, line 318 -
更新地图 maxzoom。
Name Type Description maxZoom
number 地图最大缩放级别。
- Version:
- 11.2.1
-
inherited setMinZoom(minZoom)
common/mapping/WebMapBase.js, line 305 -
更新地图 minzoom。
Name Type Description minZoom
number 地图最小缩放级别。
- Version:
- 11.2.1
-
inherited setPitch(pitch)
common/mapping/WebMapBase.js, line 242 -
更新地图倾角。
Name Type Description pitch
number 地图倾角。
-
inherited setRasterTileSize(tileSize)
common/mapping/WebMapBase.js, line 276 -
更新地图栅格图层瓦片大小。
Name Type Description tileSize
number 栅格瓦片大小。
-
inherited setRenderWorldCopies(isWorldCopy)
common/mapping/WebMapBase.js, line 216 -
更新地图连续渲染。
Name Type Description isWorldCopy
boolean 地图是否连续渲染。
-
inherited setStyle(style, preserveMap)
common/mapping/WebMapBase.js, line 256 -
更新地图样式。
Name Type Description style
Object 地图 style 样式
preserveMap
boolean 保留地图实例,覆盖图层样式。
-
inherited deprecated setWebMapOptions(webMapOptions)
common/mapping/WebMapBase.js, line 331 -
设置 webMap 参数。
Name Type Description webMapOptions
Object webMap 参数。
-
inherited toggleLayerVisible(layer, visible)
common/mapping/WebMapBase.js, line 394 -
设置图层显隐。
Name Type Description layer
string 图层信息。
visible
boolean 图层是否可见。true 表示显示,false 表示隐藏。
- Version:
- 11.2.1
-
inherited updateOverlayLayer(layerInfo, features, mergeByField)
common/mapping/WebMapBase.js, line 426 -
更新 geojson 图层要素信息。
Name Type Description layerInfo
Object 图层信息。
Name Type Description id
string 可选 图层信息 id。
renderSource
string 可选 图层渲染 source 信息。
features
Array 要素信息。
mergeByField
string 属性关联字段。
- Version:
- 11.2.1