new FeatureServer(options)
要素服务
| Name | Type | Default | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | {} |
可选
构造参数
|
Example
//igs2.0的要素服务
// ES5引入方式
const { FeatureServer } = zondy.service
// ES6引入方式
import { FeatureServer } from "@mapgis/webclient-common"
const featureServer = new FeatureServer({
//服务地址,folder为IGS的服务管理中的文件夹夹名称,serviceName为发布的服务名
url: 'http://192.168.88.12:8089/igs/rest/services/{folder}/{serviceName}/FeatureServer'
})
//基于矢量图层的要素查询
const featureServer = new FeatureServer({
//服务地址,IGS1.0地址
url: 'http://localhost:6163/igs/rest/mrfs/layer'
//服务地址,IGS2.0地址
//url: 'http://localhost:8089/igs/rest/mrfs/layer'
})
//基于矢量文档的要素查询
const featureServer = new FeatureServer({
//服务地址,IGS1.0地址,serviceName为发布的服务名
url: 'http://localhost:6163/igs/rest/mrfs/docs/{serviceName}'
//服务地址,IGS2.0地址,serviceName为发布的服务名
//url: 'http://localhost:8089/igs/rest/mrfs/docs/{serviceName}'
})
Extends
Members
-
clientIdString undefined
-
客户端标识
-
enableGlobeFetchBoolean
-
是否使用确据唯一的fetch对象,默认为true,当设为false时,会使用自己私有的fetch对象,所有的请求设置不会影响全局
Example
//设置请求基地址 // ES5引入方式 const { BaseServer } = zondy.service // ES6引入方式 import { BaseServer } from "@mapgis/webclient-common" let BaseServer = new BaseServer({ //请求基地址 url: '你的URL', //使用私有的fetch对象 enableGlobeFetch: false, //此时设置token等属性,不会影响全局的fetch对象 tokenValue: '你的token' }); //继续使用全局fetch BaseServer.enableGlobeFetch = true; -
headersString
-
请求头参数
Example
//设置请求头参数 // ES5引入方式 const { BaseServer } = zondy.service // ES6引入方式 import { BaseServer } from "@mapgis/webclient-common" let BaseServer = new BaseServer({ //请求头 headers: { //设置Content-Type为multipart/form-data 'Content-Type': 'multipart/form-data', //设置token 'token': '你的token' } }); //动态修改 BaseServer.headers.token = '新token'; -
requestInterceptorfunction
-
请求发送拦截器
Example
//设置拦截器,任何一个继承自BaseServer的对象都可以设置,全局唯一 // ES5引入方式 const { BaseServer,RequestInterceptor } = zondy.service // ES6引入方式 import { BaseServer,RequestInterceptor } from "@mapgis/webclient-common" let BaseServer = new BaseServer({ //设置请求发送拦截器 requestInterceptor: new RequestInterceptor({ //请求发送前进行统一处理 before: function(config) { //执行你的业务逻辑 //注意必须显示返回config对象,如果返回为空,则不发送请求 return config; }, //请求发送失败时进行统一处理 failure: function(error) { //执行你的业务逻辑 } }) }); //动态修改 BaseServer.requestInterceptor.before = function() {}; -
requestTimeoutString
-
请求超时时间,默认45000ms,即45s
Example
//设置超时时间 //初始化AddressServer服务对象 // ES5引入方式 const { BaseServer } = zondy.service // ES6引入方式 import { BaseServer } from "@mapgis/webclient-common" let BaseServer = new BaseServer({ //超时时间 requestTimeout: 2000 }); //动态修改 BaseServer.requestTimeout = 3000; -
responseInterceptorfunction
-
请求响应拦截器
Example
//设置拦截器,任何一个继承自BaseServer的对象都可以设置,全局唯一 // ES5引入方式 const { BaseServer,ResponseInterceptor } = zondy.service // ES6引入方式 import { BaseServer,ResponseInterceptor } from "@mapgis/webclient-common" let BaseServer = new BaseServer({ //设置请求响应拦截器 responseInterceptor: new ResponseInterceptor({ //执行请求响应,接口调用成功时会执行的回调 success: function(result) { //执行你的业务逻辑 //注意必须显示返回result对象,如果返回为空,则不执行请求响应成功回调 return result; }, //请求响应成功,接口调用失败时会执行的函数 failure: function(result) { //执行你的业务逻辑 //注意必须显示返回result对象,如果返回为空,则不执行回调韩式 return result; } }) }); //动态修改 BaseServer.responseInterceptor.success = function() {}; -
tokenAttachTypeTokenAttachType
-
指定token附加到何处
Example
//设置token值 // ES5引入方式 const { BaseServer } = zondy.service const { TokenAttachType } = zondy.enum // ES6引入方式 import { BaseServer,TokenAttachType } from "@mapgis/webclient-common" let BaseServer = new BaseServer({ //token名 tokenKey: '你的token key', //token值 tokenValue: '你的token值', //指定token附加到url后面 tokenAttachType: TokenAttachType.url }); //动态修改 BaseServer.tokenAttachType = TokenAttachType.header; -
tokenKeyString
-
token名
Example
//设置token名 // ES5引入方式 const { BaseServer } = zondy.service // ES6引入方式 import { BaseServer } from "@mapgis/webclient-common" let BaseServer = new BaseServer({ //token名 tokenKey: '你的tokenKey' }); //动态修改 BaseServer.tokenKey = '新tokenKey'; -
tokenValueString
-
token值
Example
//设置token值 // ES5引入方式 const { BaseServer } = zondy.service // ES6引入方式 import { BaseServer } from "@mapgis/webclient-common" let BaseServer = new BaseServer({ //token值 tokenValue: '你的token值' }); //动态修改 BaseServer.tokenValue = '新token值'; -
urlString
-
服务基地址
Example
//设置请求基地址 // ES5引入方式 const { BaseServer } = zondy.service // ES6引入方式 import { BaseServer } from "@mapgis/webclient-common" let BaseServer = new BaseServer({ //请求基地址 url: '你的URL' }); //动态修改 BaseServer.url = '新URL';
Methods
-
addFeature(options){Promise.<Object>}
service/igs/FeatureServer.js, line 315 -
指定图层的要素添加,支持 IGS2.0 要素服务、基于矢量图层的要素服务以及基于矢量文档的要素服务。
Name Type Description optionsObject 指定图层的要素添加参数
Name Type Default Description layerIdString '0' 可选 IGS2.0 场景下的图层id
methodString FetchMethod.post 可选 请求类型。当前实现会强制转为 POST
successfunction 可选 查询成功回调函数,若使用Promise方式则不必填写
failurefunction 可选 查询失败回调函数,若使用Promise方式则不必填写
featuresArray [] 可选 IGS2.0 场景下要添加的要素集合
gdbpString 可选 基于矢量图层(IGS1.0 gdbp)场景下的 gdbp 地址
featureSetObject 可选 IGS1.0 场景下的要素集合(旧版要素结构)
mapIndexNumber 可选 基于矢量文档场景下的地图序号(从 0 开始)
layerIndexNumber 可选 基于矢量文档场景下的图层序号(从 0 开始)
Returns:
Type Description Promise.<Object> 添加要素结果 Examples
IGS2.0的要素新增示例
// 创建一个线要素 // ES5引入方式 const { Feature } = zondy // ES6引入方式 import { Feature } from "@mapgis/webclient-common" const lineString = new Feature({ //可填空或者和数据库中的表结构一一对应 attributes: {}, //可填空或者和系统库中的样式一一对应 styleInfo: {}, //设置几何 geometry: new zondy.geometry.LineString({ coordinates: [ [110.74, 32.41], [112.89, 31.06], [110.15, 30.16] ] }) }) // 添加要素 featureServer.addFeature({ // 指定图层id layerId: '0', // 要添加的要素,可以添加多个要素 features: [lineString] }) .then((res) => { //成功回调函数 console.log('添加要素: ', res) }) .catch((res) => { //失败回调函数 console.log('添加要素失败: ', res) })基于矢量图层的要素新增示例
// 初始化资源服务 // ES5引入方式 const { ResourceServer} = zondy.service const { Point} = zondy.geometry const { Feature } = zondy // ES6引入方式 import { ResourceServer,Point,Feature } from "@mapgis/webclient-common" const resourceServer = new ResourceServer({ // 目录服务基地址,port可填6163(.net服务)或者8089(Java服务) url: 'http://localhost:6163/igs/rest/mrcs' }) // 查询数据库表结构 resourceServer.queryGDBPInfo({ // 要查询的gdbp的url gdbpUrl: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地' }) .then((result) => { // 表结构为result.data.FieldAtt // 创建一个要素 const feature = new Feature({ // 设置要素id,若id已在数据库中存在,则自增id id: 0, // 设置几何,支持点、多点、线、多线、区、多区 geometry: new Point({ coordinates: [110.66482, 31.747766] }), // 这里的属性一定要和数据库的表结构一一对应,顺序也不能出错 attributes: { "CODE": "1", "NAME": "神龙架林区", "mpLayer": "0" }, //设置样式 styleInfo: {} }) // 创建新增要素的结构体 const featureSet = { // 设置表结构,必填 AttStruct: result.data.FieldAtt, // 设置要添加的要素,客串多个要素 SFEleArray: [feature.toOldIGSFeature()] } // 添加要素 featureServer.addFeature({ // 新增要素的结构体 featureSet: featureSet, // gdbo地址,仅支持单表添加 gdbp: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地' }) .then((result) => { console.log('新增要素成功:', result); }) .catch((result) => { console.log('新增要素失败:', result); }) }) .catch((result) => { console.log('查询GDBO失败:', result); })基于矢量文档的要素新增示例
// 初始化资源服务 // ES5引入方式 const { MultiPoint} = zondy.geometry const { Feature } = zondy // ES6引入方式 import { MultiPoint,Feature } from "@mapgis/webclient-common" const resourceServer = new ResourceServer({ // 目录服务基地址,port可填6163(.net服务)或者8089(Java服务) url: 'http://localhost:6163/igs/rest/mrcs' }) // 查询数据库表结构 resourceServer.queryGDBPInfo({ // 要查询的gdbp的url gdbpUrl: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地' }) .then((result) => { // 创建一个要素 const feature = new Feature({ // 设置要素id,若id已在数据库中存在,则自增id id: 0, // 设置几何,支持点、多点、线、多线、区、多区 geometry: new MultiPoint({ coordinates: [ [109.47509, 30.270342], [111.27724, 30.706085] ] }), // 这里的属性一定要和数据库的表结构一一对应 attributes: { "CODE": "0", "Name": "测试点多点2", "mpLayer": "0" }, // 设置样式 styleInfo: {} }) // 创建新增要素的结构体 const featureSet = { // 设置表结构,必填 AttStruct: result.data.FieldAtt, // 设置要添加的要素,客串多个要素 SFEleArray: [feature.toOldIGSFeature()] } // 添加要素 featureServer.addFeature({ // 新增要素的结构体 featureSet: featureSet, // 地图在文档下的序号,从0开始编号 mapIndex: 0, // 图层序号,从0开始编号 layerIndex: 2 }) .then((result) => { console.log('新增要素成功:', result); }) .catch((result) => { console.log('新增要素失败:', result); }) }) .catch((result) => { console.log('查询GDBO失败:', result); }) -
deleteFeature(options){Promise.<Object>}
service/igs/FeatureServer.js, line 488 -
指定图层的要素删除,支持 IGS2.0 要素服务、基于矢量图层的要素服务以及基于矢量文档的要素服务。
Name Type Description optionsObject 指定图层的要素删除参数
Name Type Default Description layerIdString 可选 IGS2.0 场景下图层id
methodString FetchMethod.post 可选 请求类型,必须为 POST
successfunction 可选 查询成功回调函数,若使用Promise方式则不必填写
failurefunction 可选 查询失败回调函数,若使用Promise方式则不必填写
objectIdsString 可选 过滤id,多个用英文逗号分隔(使用大数据作为数据源发布的要素服务,该参数是唯一有效参数)
whereString 可选 属性条件,类SQL语句
geometryGeometry 可选 空间几何条件
distanceNumber 可选 几何缓冲的距离,geometry为点、线时有效
returnDeleteResultsBoolean true 可选 是否返回每个要素删除的结果,默认为true,如果要高效的批量删除,应设置为false
gdbpString 可选 基于矢量图层场景下的 gdbp 地址,允许多个图层,图层间用“;”分隔,例如: gdbp=gdbp://MapGisLocal/示例数据/ds/世界地图/sfcls/海洋陆地;gdbp://sa@SqlServerGIS/MPDBMASTER/ds/兰伯特(全国)_400万/sfcls/中国地级县
objectIdsString 可选 需要删除的要素 OID。单图层多个值用“,”分隔,多图层间用“;”分隔,例如: objectIds=1,2,3;2,3,4;8
mapIndexNumber 可选 基于矢量文档场景下地图序号,从 0 开始
layerIndexNumber 可选 基于矢量文档场景下图层序号,从 0 开始
Returns:
Type Description Promise.<Object> 返回要素删除结果 Examples
IGS2.0的要素删除示例
// 删除要素 featureServer.deleteFeature({ // 图层id layerId: '0', // 要删除的要素id,多个要素id以','分割 objectIds: '0,1,2,3,5,6' }) .then((res)=>{ console.log('要素删除成功:', res); }) .catch((res)=>{ console.log('要素删除失败:', res); })基于矢量地图的要素删除示例
// 删除要素 featureServer.deleteFeature({ // gdbp的url gdbp: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地', // 要删除的要素id,多个id以','分割 objectIds: '18053' }) .then((res)=>{ console.log('要素删除成功:', res); }) .catch((res)=>{ console.log('要素删除失败:', res); })基于基于矢量文档的要素删除示例
// 删除要素 featureServer.deleteFeature({ // 地图在文档下的序号,从0开始编号 mapIndex: 0, // 图层序号,从0开始编号 layerIndex: 2, // 要删除的要素id,多个id以','分割 objectIds: '18057' }) .then((res)=>{ console.log('要素删除成功:', res); }) .catch((res)=>{ console.log('要素删除失败:', res); }) -
queryFeatureById(options){Promise.<Object>}
service/igs/FeatureServer.js, line 972 -
根据 id 获取指定图层中的指定要素,IGS2.0 新增能力。
Name Type Description optionsObject 获取指定图层指定要素参数
Name Type Default Description layerIdString 图层id,必传
featureIdString 要素id,必传
methodString FetchMethod.get 可选 请求类型。当前实现仅支持 GET
successfunction 可选 查询成功回调函数,若使用Promise方式则不必填写
failurefunction 可选 查询失败回调函数,若使用Promise方式则不必填写
Returns:
Type Description Promise.<Object> 返回指定图层指定要素 Example
根据id获取指定图层指定要素
featureServer.queryFeatureById({ // 图层id layerId: '0', // 要素id featureId: '437' }) .then((res) => { console.log('要素查询成功:', res) }) .catch((res) => { console.log('要素查询失败:', res) }) -
queryFeatures(options){Promise.<QueryFeaturesResult>}
service/igs/FeatureServer.js, line 121 -
指定图层的要素查询。 [指定图层查询使用示例]
Name Type Description optionsQueryFeaturesOptions 指定图层要素查询参数
Returns:
Type Description Promise.<QueryFeaturesResult> 指定图层要素查询结果 -
queryFeaturesInLayers(options){Promise.<QueryFeaturesResult>}
service/igs/FeatureServer.js, line 131 -
多图层要素查询。 [多图层查询使用示例]
Name Type Description optionsQueryFeaturesInLayersOptions 多图层要素查询参数
Returns:
Type Description Promise.<QueryFeaturesResult> 多图层要素查询结果 -
queryLayerInfo(options){Promise.<Object>}
service/igs/FeatureServer.js, line 96 -
获取要素服务图层信息。
IGS2.0 直接请求 {baseUrl}/{layerId}?f=json。 IGS1.0 会先将基地址中的 mrfs 转为 mrcs,再按文档图层路径请求。
Name Type Description optionsObject 查询参数
Name Type Description layerIdString 图层id,必传
successfunction 可选 查询成功回调函数,若使用Promise方式则不必填写
failurefunction 可选 查询失败回调函数,若使用Promise方式则不必填写
Returns:
Type Description Promise.<Object> 返回要素服务图层信息 Example
获取要素服务图层信息
featureServer.queryLayerInfo({ // 图层id layerId: '0' }) .then((res)=>{ console.log('查询图层信息成功:', res) }) .catch((res)=>{ console.log('查询图层信息失败:', res) }) -
inherited queryServerInfo(options){Promise.<Object>}
service/BaseServer.js, line 140 -
获取服务信息,IGS2.0新增服务
Name Type Default Description optionsObject {} 可选 查询参数
Name Type Default Description successfunction 无 可选 查询成功回调函数,若使用Promise方式则不必填写
failurefunction 无 可选 查询失败回调函数,若使用Promise方式则不必填写
Returns:
Type Description Promise.<Object> 服务信息查询结果 Examples
获取服务信息-回调方式
server.queryServerInfo({ success: function (result) { console.log('请求成功:', result); }, failure: function (result) { console.log('请求失败:', result); } });获取服务信息-promise方式
server.queryServerInfo({ }) .then(function (result) { console.log('请求成功:', result); }).catch(function (result) { console.log('请求失败:', result); }); -
updateFeature(options){Promise.<Object>}
service/igs/FeatureServer.js, line 840 -
指定图层的要素更新,支持 IGS2.0 要素服务、基于矢量图层的要素服务以及基于矢量文档的要素服务。
Name Type Description optionsObject 指定图层的要素更新参数
Name Type Default Description layerIdString 可选 IGS2.0 场景下图层id
methodString FetchMethod.post 可选 请求类型。当前实现会强制转为 POST
successfunction 可选 查询成功回调函数,若使用Promise方式则不必填写
failurefunction 可选 查询失败回调函数,若使用Promise方式则不必填写
featuresArray [] 可选 IGS2.0 场景下要更新的要素集合,属性中需包含 FID
gdbpString 可选 基于矢量图层(IGS1.0 gdbp)场景下的 gdbp 地址
featureSetObject 可选 IGS1.0 场景下的要素集合(旧版要素结构)
mapIndexNumber 可选 基于矢量文档场景下地图序号,从 0 开始
layerIndexNumber 可选 基于矢量文档场景下图层序号,从 0 开始
Returns:
Type Description Promise.<Object> 返回图层更新结果 Examples
IGS2.0的要素更新示例
// 创建线要素 // ES5引入方式 const { Feature } = zondy const { LineString } = zondy.geometry // ES6引入方式 import { Feature } from "@mapgis/webclient-common" const lineString = new Feature({ // 更新要素时需要传一个FID来指定要素,其他的属性值可以根据需求来设置 attributes: { FID:'0' }, // 更新几何,注意几何一定要是GDBP表对应的几何类型 geometry: new LineString({ coordinates: [ [110.74, 32.41], [112.89, 31.06], [110.15, 30.16] ] }) }) // 更新线要素 featureServer.updateFeature({ // 图层id layerId: '1', // 要更新的要素,支持一次更新多个要素 features: [lineString] }) .then((res) => { console.log('要素更新成功: ', res) }) .catch((res) => { console.log('要素更新失败: ', res) })基于矢量图层的要素更新示例
// 初始化资源服务 // ES5引入方式 const { ResourceServer } = zondy.service const { Feature } = zondy const { Point } = zondy.geometry // ES6引入方式 import { ResourceServer,Feature, Point} from "@mapgis/webclient-common" const resourceServer = new ResourceServer({ // 目录服务基地址,port可填6163(.net服务)或者8089(Java服务) url: 'http://localhost:6163/igs/rest/mrcs' }) // 查询数据库表结构 resourceServer.queryGDBPInfo({ // 要查询的gdbp的url gdbpUrl: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地' }) .then((result) => { // 表结构为result.data.FieldAtt // 创建一个要素 const feature = new Feature({ // 设置更新要素的id id: 1220, // 设置几何,支持点、多点、线、多线、区、多区 geometry: new Point({ coordinates: [110.66482, 31.747766] }), // 更新属性 attributes: { "CODE": "1", "NAME": "新的神龙架林区", "mpLayer": "0" } }) // 创建更新要素的结构体 const featureSet = { // 设置表结构,必填 AttStruct: result.data.FieldAtt, // 设置要添加的要素,客串多个要素 SFEleArray: [feature.toOldIGSFeature()] } // 更新要素 featureServer.updateFeature({ // 更新要素的结构体 featureSet: featureSet, // gdbo地址,仅支持单表添加 gdbp: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地' }) .then((result) => { console.log('更新要素成功:', result); }) .catch((result) => { console.log('更新要素失败:', result); }) }) .catch((result) => { console.log('查询GDBO失败:', result); })基于矢量文档的要素更新示例
// 初始化资源服务 // ES5引入方式 const { ResourceServer } = zondy.service const { Feature } = zondy const { MultiPoint } = zondy.geometry // ES6引入方式 import { ResourceServer,Feature,MultiPoint } from "@mapgis/webclient-common" const resourceServer = new ResourceServer({ // 目录服务基地址,port可填6163(.net服务)或者8089(Java服务) url: 'http://localhost:6163/igs/rest/mrcs' }) // 查询数据库表结构 resourceServer.queryGDBPInfo({ // 要查询的gdbp的url gdbpUrl: 'gdbp://MapGisLocal/ClientTheme/sfcls/湖北省市驻地' }) .then((result) => { // 创建一个要素 const feature = new Feature({ // 设置要更新的要素id id: 0, // 设置几何,支持点、多点、线、多线、区、多区 geometry: new MultiPoint({ coordinates: [ [109.47509, 30.270342], [111.27724, 30.706085] ] }), // 更新属性 attributes: { "CODE": "0", "Name": "多点", "mpLayer": "0" } }) // 创建更新要素的结构体 const featureSet = { // 设置表结构,必填 AttStruct: result.data.FieldAtt, // 设置要更新的要素,客串多个要素 SFEleArray: [feature.toOldIGSFeature()] } // 更新要素 featureServer.updateFeature({ // 更新要素的结构体 featureSet: featureSet, // 地图在文档下的序号,从0开始编号 mapIndex: 0, // 图层序号,从0开始编号 layerIndex: 2 }) .then((result) => { console.log('更新要素成功:', result); }) .catch((result) => { console.log('更新要素失败:', result); }) }) .catch((result) => { console.log('查询GDBO失败:', result); })更新要素样式
// ES5引入方式 const { ResourceServer, FeatureServer } = zondy.service const { Polygon } = zondy.geometry const { Feature } = zondy // ES6引入方式 import { ResourceServer, FeatureServer, Polygon, Feature } from "@mapgis/webclient-common" // 初始化资源服务对象 const resourceServer = new ResourceServer({ url: 'http://{ip}:{port}/igs/rest/services/system/ResourceServer' }) // 初始化要素服务对象 const featureServer = new FeatureServer({ url: 'http://{ip}:{port}/igs/rest/services/{要素服务名}/FeatureServer' }) // 查询要素图层信息 featureServer.queryLayerInfo({ // 要素图层ID layerId: '0' }).then(function (layerInfo) { // 通过gdbp地址查询系统库 resourceServer.queryTempDataInfo({ // gdbp地址 url: layerInfo.data.url }).then(function (tempDataInfo) { // 获取系统库名称 const systemLibGuid = tempDataInfo.data.systemLibGuid // 查询要素 featureServer.queryFeaturesInLayers({ // 图层id layerId: '0', // 返回要素样式 returnStyle: true }).then(function (featureInfo) { // 获取要素 const featureData = featureInfo.data.layers[0].features[0] // 当通过颜色查找色号时,MapGIS桌面会通过颜色值的模糊匹配去查找色号,两个不同的颜色,查找出的色号可能会一样,因此无法通过颜色查找色号 // 因此推荐用户通过querySystemColorList查询到指定系统库的颜色列表,然后再前端根据自己的项目实际情况,写一个调色板来选择色号,注意该接口需要设置翻页参数 // 此步骤是可选项,也可以像下方代码,直接更改色号 resourceServer.querySystemColorList({ // 系统库ID sysLib: systemLibGuid, // 查询第几页 page: 1, // 每页数量 pageSize: 20, }).then(function (colorList) { console.log("色号列表:", colorList) }) // 直接更改色号 featureData.styleInfo.fillColor = 112 // 构造要更新的要素对象 const feature = new Feature({ // 更新属性,可以更新部分属性,但是FID是必选项,{FID:'xxx'} attributes: featureData.attributes, // 更新几何,必须更新几何 geometry: new Polygon({ coordinates: featureData.geometry.coordinates }), // 更新样式,可选项 styleInfo: featureData.styleInfo }) // 更新要素对象 featureServer.updateFeature({ // 请求方式 method: 'POST', // 要更新的图层ID layerId: '0', // 要更新要素对象 features: [feature] }) }) }) })