new WebMap(id, options, mapOptions)
Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/maplibregl/iclient-maplibregl.js"></script>
<script>
new maplibregl.supermap.WebMap(id, options, mapOptions);
</script>
// ES6 Import
import { WebMap } from '@supermapgis/iclient-maplibregl';
new WebMap(id, options, mapOptions);
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
number |
iPortal|Online 地图 ID。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
基础参数。
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mapOptions |
Object |
地图参数。
|
- Version:
- 11.3.0
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
- WebMap#event:xyztilelayernotsupport
Extends
Events
-
inherited deprecated addlayerssucceeded
common/mapping/WebMapBase.js, line 103 -
地图创建成功。自v11.2.1废弃,请使用
WebMapBase#event:mapcreatesucceeded替代。Properties:
Name Type Description mapObject MapBoxGL Map 实例。
mapparamsObject 地图信息。
mapParams.titlestring 地图标题。
mapParams.descriptionstring 地图描述。
layersAarry 图层列表。
-
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 errorObject 失败原因。
mapObject MapBoxGL Map 实例。
layerObject 图层信息。
-
inherited deprecated getmapfailed
common/mapping/WebMapBase.js, line 120 -
地图创建失败。自v11.2.1废弃,请使用
WebMapBase#event:mapcreatefailed替代。Properties:
Name Type Description errorObject 失败原因。
-
inherited layercreatefailed
common/mapping/WebMapBase.js, line 127 -
图层创建失败。
Properties:
Name Type Description errorObject 失败原因。
mapObject MapBoxGL Map 实例。
layerObject 图层信息。
-
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 errorObject 失败原因。
-
inherited mapcreatesucceeded
common/mapping/WebMapBase.js, line 93 -
地图创建成功。
Properties:
Name Type Description mapObject MapBoxGL Map 实例。
mapparamsObject 地图信息。
mapParams.titlestring 地图标题。
mapParams.descriptionstring 地图描述。
layersAarry 图层列表。
-
inherited mapinitialized
common/mapping/WebMapBase.js, line 87 -
地图初始化成功。
Properties:
Name Type Description mapObject 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 removeMapboolean 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 idstring 指定图层 id。
layerInfoObject 可选 复制图层信息。如 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 layersArray 图层列表。
topLayerBeforeIdstring 图层列表中置顶图层指定的 beforeId。
- Version:
- 11.2.1
-
inherited resize(keepBounds)
common/mapping/WebMapBase.js, line 183 -
调整地图大小。
Name Type Default Description keepBoundsboolean false 可选 是否保持当前地图范围。
-
inherited setBearing(pitch)
common/mapping/WebMapBase.js, line 228 -
更新地图旋转角度。
Name Type Description pitchnumber 地图旋转角度。
-
inherited setCenter(center)
common/mapping/WebMapBase.js, line 201 -
更新地图中心点。
Name Type Description centerArray 地图中心点。
-
setCRS(crs)
maplibregl/mapping/WebMap.js, line 93 -
更新地图投影。
Name Type Description crsstring | Object 地图 crs。
-
inherited deprecated setMapOptions(mapOptions)
common/mapping/WebMapBase.js, line 342 -
设置 map 参数。
Name Type Description mapOptionsObject map 参数。
-
inherited setMaxBounds(maxBounds)
common/mapping/WebMapBase.js, line 293 -
更新地图 maxbounds。
Name Type Description maxBoundsnumber 地图最大缩放范围。
-
inherited setMaxZoom(maxZoom)
common/mapping/WebMapBase.js, line 318 -
更新地图 maxzoom。
Name Type Description maxZoomnumber 地图最大缩放级别。
- Version:
- 11.2.1
-
inherited setMinZoom(minZoom)
common/mapping/WebMapBase.js, line 305 -
更新地图 minzoom。
Name Type Description minZoomnumber 地图最小缩放级别。
- Version:
- 11.2.1
-
inherited setPitch(pitch)
common/mapping/WebMapBase.js, line 242 -
更新地图倾角。
Name Type Description pitchnumber 地图倾角。
-
inherited setRasterTileSize(tileSize)
common/mapping/WebMapBase.js, line 276 -
更新地图栅格图层瓦片大小。
Name Type Description tileSizenumber 栅格瓦片大小。
-
inherited setRenderWorldCopies(isWorldCopy)
common/mapping/WebMapBase.js, line 216 -
更新地图连续渲染。
Name Type Description isWorldCopyboolean 地图是否连续渲染。
-
inherited setStyle(style, preserveMap)
common/mapping/WebMapBase.js, line 256 -
更新地图样式。
Name Type Description styleObject 地图 style 样式
preserveMapboolean 保留地图实例,覆盖图层样式。
-
inherited deprecated setWebMapOptions(webMapOptions)
common/mapping/WebMapBase.js, line 331 -
设置 webMap 参数。
Name Type Description webMapOptionsObject webMap 参数。
-
inherited toggleLayerVisible(layer, visible)
common/mapping/WebMapBase.js, line 394 -
设置图层显隐。
Name Type Description layerstring 图层信息。
visibleboolean 图层是否可见。true 表示显示,false 表示隐藏。
- Version:
- 11.2.1
-
inherited updateOverlayLayer(layerInfo, features, mergeByField)
common/mapping/WebMapBase.js, line 426 -
更新 geojson 图层要素信息。
Name Type Description layerInfoObject 图层信息。
Name Type Description idstring 可选 图层信息 id。
renderSourcestring 可选 图层渲染 source 信息。
featuresArray 要素信息。
mergeByFieldstring 属性关联字段。
- Version:
- 11.2.1