Class: ServerUtil

ServerUtil

new ServerUtil()

service/support/ServerUtil.js, line 36

根据输入的URL生成出图地址的工具类

Methods

ServerUtil.exportSimpleFeatureClass(url, options){Promise}

service/support/ServerUtil.js, line 1302

导出简单要素类

Name Type Description
url String

服务地址

options Object

请求参数

Name Type Default Description
headers String 可选

请求头参数

success function 可选

查询成功回调函数,若使用Promise方式则不必填写

failure function 可选

查询失败回调函数,若使用Promise方式则不必填写

method FetchMethod FetchMethod.post 可选

请求方法,仅支持POST方式

tokenKey String 'token' 可选

token名

tokenValue String null 可选

token值

spatialReference SpatialReference 可选

输出几何空间参照系

source String | Object 可选

源数据,必传,支持传入gdbp字符串或者1.0简单要素类json结构

geometryType String 可选

几何的类型,此项必传,可传入'Pnt'、'Lin'、'Reg'等

exportFormat String 可选

导出的数据格式,可选shp、6x等

userName String 可选

数据源用户名

password String 可选

数据源密码

f String 'json' 可选

请求格式

Returns:
Type Description
Promise 导出的数据 1.输入gdbp地址 ServerUtil.exportSimpleFeatureClass( "http://localhost:8089/onemap/featureSet/export", { success: (res) => { console.log("success: ", res); }, spatialReference: new SpatialReference({ wkid: 4326 }), source: "gdbp://MapGisLocal/ClientTheme/ds/epsg4326/sfcls/%E6%B9%96%E5%8C%97%E7%9C%81%E5%B8%82%E7%BA%A7%E5%8C%BA%E5%88%922buffer180422", geometryType: "Reg", exportFormat: "shp", f: "json", } ).then((res) => { console.log("res: ", res); }); 2.输入1.0简单要素类json结构 ServerUtil.exportSimpleFeatureClass( "http://localhost:8089/onemap/featureSet/export", { success: (res) => { console.log("success: ", res); }, spatialReference: new SpatialReference({ wkid: 4326 }), source: { TotalCount: 0, AttStruct: { FldName: ["名称", "描述", "中心点坐标", "坐标串"], FldNumber: 4, FldType: ["string", "string", "string", "string"], }, SFEleArray: [ { fGeom: { RegGeom: [ { GID: 0, Rings: [ { Arcs: [ { ArcID: 0, Dots: [ { x: 118.5526955115443, y: 36.297694514643496, nearDis: null, CLASS_NAME: "Zondy.Object.Point2D", }, { x: 118.64033726740598, y: 36.279919285285835, nearDis: null, CLASS_NAME: "Zondy.Object.Point2D", }, { x: 118.60009612316588, y: 36.23646872463328, nearDis: null, CLASS_NAME: "Zondy.Object.Point2D", }, { x: 118.54158599319635, y: 36.241159410158325, nearDis: null, CLASS_NAME: "Zondy.Object.Point2D", }, { x: 118.53812969859831, y: 36.27885183364089, nearDis: null, CLASS_NAME: "Zondy.Object.Point2D", }, { x: 118.5526955115443, y: 36.297694514643496, nearDis: null, CLASS_NAME: "Zondy.Object.Point2D", }, ], }, ], }, ], }, ], PntGeom: null, LinGeom: null, }, GraphicInfo: { InfoType: 3, RegInfo: { EndColor: 1, FillColor: 1, FillMode: 0, OutPenWidth: 1, OverMethod: 0, PatAngle: 1, PatColor: 1, PatHeight: 1, PatID: 27, PatWidth: 1, }, PntInfo: null, LinInfo: null, }, AttValue: [ "标注 2025-12-02 11:29:35", "2323", "118.5838284171114,36.26708161963839,0", "118.5526955115443,36.297694514643496 118.64033726740598,36.279919285285835 118.60009612316588,36.23646872463328 118.54158599319635,36.241159410158325 118.53812969859831,36.27885183364089 118.5526955115443,36.297694514643496", ], FID: 0, bound: null, ftype: 3, }, ], }, geometryType: "Reg", exportFormat: "shp", f: "json", } ).then((res) => { console.log("res: ", res); });

ServerUtil.getImage(url, options){RequestStructure}

service/support/ServerUtil.js, line 156

根据url和出图参数,返回地图图片出图结构体,支持的服务如下:
1、场景服务2.0-覆盖物图层,具体出图参数参考SceneServer.getCoverings() 2、资源服务2.0-GDBP出图,具体出图参数参考ResourceServer.getImage() 3、地图图片图层1.0和2.0,具体出图参数参考MapServer.getImage() 4、资源服务1.0-GDBP出图,具体出图参数参考MapServer.getImage() 5、ArcGIS的地图图片服务,具体出图参数参考ArcGISMapServer.getImage() 6、WMS的地图图片服务,具体出图参数参考WMSServer.getImage() 7、影像服务,具体出图参数参考ImageServer.getImage()

Name Type Description
url String

服务地址

options Object

出图参数

Name Type Default Description
headers Object {} 可选

请求头对象

queryParameters Object {} 可选

额外请求参数,优先级小于其他的出图参数,同名属性,会被下面的出图参数覆盖

tokenKey String 'token' 可选

token名

tokenValue String null 可选

token值

formatMode String 'normal' 可选

生成参数格式,normal: 按照默认逻辑设置参数,replace: 将部分参数设置为可替换的模版字符串

Returns:
Type Description
RequestStructure 请求结构体

ServerUtil.getModelCache(url, options){RequestStructure}

service/support/ServerUtil.js, line 360

根据url和出图参数,返回模型缓存出图结构体,支持的服务如下:
1、场景服务1.0和2.0-模型缓存,具体出图参数参考SceneServer.getModelCache() 2、M3D服务-模型缓存,具体出图参数参考M3DServer.getModelCache() 3、C3sium3Dtils-模型缓存,具体出图参数参考Cesium3DTilesServer.getModelCache()

Name Type Description
url String

服务地址

options Object

出图参数

Name Type Default Description
headers Object {} 可选

请求头对象

queryParameters Object {} 可选

额外请求参数,优先级小于其他的出图参数,同名属性,会被下面的出图参数覆盖

tokenKey String 'token' 可选

token名

tokenValue String null 可选

token值

Returns:
Type Description
RequestStructure 请求结构体

ServerUtil.getTerrain(url, options){RequestStructure}

service/support/ServerUtil.js, line 275

根据url和出图参数,返回MapGIS地形瓦片出图结构体,具体出图参数参考SceneServer.getTerrainTile()

Name Type Description
url String

服务地址

options Object

出图参数

Name Type Default Description
headers Object {} 可选

请求头对象

queryParameters Object {} 可选

额外请求参数,优先级小于其他的出图参数,同名属性,会被下面的出图参数覆盖

tokenKey String 'token' 可选

token名

tokenValue String null 可选

token值

Returns:
Type Description
RequestStructure 请求结构体

ServerUtil.getTerrainCache(url, options){RequestStructure}

service/support/ServerUtil.js, line 316

根据url和出图参数,返回地形缓存出图结构体,具体出图参数参考TerrainServer.getTerrainCache()

Name Type Description
url String

服务地址

options Object

出图参数

Name Type Default Description
headers Object {} 可选

请求头对象

queryParameters Object {} 可选

额外请求参数,优先级小于其他的出图参数,同名属性,会被下面的出图参数覆盖

tokenKey String 'token' 可选

token名

tokenValue String null 可选

token值

Returns:
Type Description
RequestStructure 请求结构体

ServerUtil.getTile(url, options){RequestStructure}

service/support/ServerUtil.js, line 57

根据url和出图参数,返回瓦片出图结构体,支持的服务如下:
1、IGS1.0和2.0的瓦片服务,具体出图参数参考TileServer.getTile() 2、ArcGIS瓦片服务,具体出图参数参考ArcGISMapServer.getTile() 3、WMTS服务,具体出图参数参考WMTSServer.getTile() 4、影像服务,具体出图参数参考ImageServer.getTile()

Name Type Description
url String

服务地址

options Object

出图参数

Name Type Default Description
headers Object {} 可选

请求头对象

queryParameters Object {} 可选

额外请求参数,优先级小于其他的出图参数,同名属性,会被下面的出图参数覆盖

tokenKey String 'token' 可选

token名

tokenValue String null 可选

token值

Returns:
Type Description
RequestStructure 请求结构体