Class: WebMap

WebMap

对接 iPortal/Online 地图类

deprecated new WebMap(options)

Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/openlayers/iclient-ol.js"></script>
<script>
  new ol.supermap.WebMap(options);
  
</script>

// ES6 Import
import { WebMap } from '@supermapgis/iclient-ol';

new WebMap(options);

openlayers/mapping/WebMap.js, line 73
Name Type Description
options Object

参数。

Name Type Default Description
target string 'map' 可选

地图容器 ID。

webMap Object | string 可选

webMap 对象,或者是获取 webMap 的 URL 地址。存在 webMap,优先使用 webMap,ID 的选项则会被忽略。

id number 可选

地图的 ID。

server string 可选

地图的地址,如果使用传入 ID,server 则会和 ID 拼接成 webMap 请求地址。

successCallback function 可选

成功加载地图后调用的函数。

errorCallback function 可选

加载地图失败调用的函数。

credentialKey string 可选

凭证密钥。例如为 "key"、"token",或者用户自定义的密钥。用户申请了密钥,此参数必填。

credentialValue string 可选

凭证密钥对应的值,credentialKey 和 credentialValue 必须一起使用。

serviceProxy Object 可选

SuperMap iPortal 内置代理信息,仅矢量瓦片图层上图才会使用。

tiandituKey string 可选

天地图的 key。

bingMapsKey string 可选

必应地图的 key。

googleMapsAPIKey string 可选

谷歌底图需要的 key。

proxy string 可选

代理地址,当域名不一致,请求会加上代理。避免跨域。

tileFormat string 可选

地图瓦片出图格式,png/webp。

mapSetting Object 可选

地图可选参数。

Name Type Description
mapClickCallback function 可选

地图被点击的回调函数。

overlays function 可选

地图的 overlays。

controls function 可选

地图的控件。

interactions function 可选

地图控制的参数。

restDataSingleRequestCount number 1000 可选

自定义 restData 分批请求,单次请求数量。

Extends

Methods

addProjctionFromWKT(wkt, crsCode){boolean}

openlayers/mapping/WebMap.js, line 4489

通过 WKT 参数扩展支持多坐标系。

Name Type Description
wkt string

字符串。

crsCode string

EPSG 信息,如: "EPSG:4490"。

Returns:
Type Description
boolean 坐标系是否添加成功。

formatUrlWithCredential(url)

openlayers/mapping/WebMap.js, line 4412

给 URL 带上凭证密钥。

Name Type Description
url string

地址。

getCustomSetting(style, color, featureType)

openlayers/mapping/WebMap.js, line 3593

获取单值专题图自定义样式对象。

Name Type Description
style Object

图层上的样式。

color string

单值对应的颜色。

featureType string

要素类型。

getEpsgInfoFromWKT(wkt){string}

openlayers/mapping/WebMap.js, line 4521

通过 WKT 参数获取坐标信息。

Name Type Description
wkt string

字符串。

Returns:
Type Description
string EPSG,如:"EPSG:4326"。

isAddProxy(url, proxy){boolean}

openlayers/mapping/WebMap.js, line 4389

url是否要带上代理

Name Type Description
url *

请求地址,必选参数。

proxy *

是否需要加上代理,可选参数。

Returns:
Type Description
boolean 是否带上代理

isCredentail(url, proxy){boolean|undefined}

openlayers/mapping/WebMap.js, line 4377

请求是否带上cookie

Name Type Description
url string

请求地址,必选参数。

proxy boolean

是否需要加上代理,可选参数。

Returns:
Type Description
boolean | undefined 是否带上cookie

refresh()

openlayers/mapping/WebMap.js, line 205

重新渲染地图。

Version:
  • 10.1.0