URI

<featureService_uri>/applyedits[.<format>]

支持的方法

POSTHEAD

父资源

featureService

介绍

要素编辑,同时编辑不同图层中的要素。applyEdits 操作可在单次请求中对与图层或表关联的要素进行编辑,该资源仅支持 POST 方法。

支持的方法:

  • POST:对与图层或表关联的要素进行编辑。
  • HEAD:检查 applyEdits 资源是否存在,或权限是否可以访问 applyEdits 资源。

资源层次

HTTP 请求方法

对如下 URI 执行 HTTP 请求,以 json 输出格式为例加以说明,其中,supermapiserver 是服务器名,{component}是服务组件名,{datasourceName}是数据源名。

http://supermapiserver:8090/iserver/services/{component}/arcgisrest/{datasourceName}/FeatureServer/applyedits.json

POST 请求

编辑不同图层中的要素

请求参数:

名称 类型 含义
f String 响应格式,支持 json、pjson
edits  

【必需】将应用的图层和编辑的 JSON 数组。

要添加或更新到要素图层的要素应包括其几何信息。要添加或更新到表中的记录不应包含几何信息。

如:

[   {     "id" : 0,     "adds" : [       {         "geometry" : {         "x": -143.501,         "y": 57.043000000000006         },         "attributes": {           "datetime": 1272210710000,           "depth": 31.100000000000001,           "region": "Andreanof Islands, Aleutian Islands, Alaska"         }       },       {         "geometry": {           "x": -72.865099999999927,           "y": -37.486599999999953         },         "attributes": {           "datetime": 1272210142999,           "depth": "40.x",           "region": "Bio-Bio, Chile"         }       }     ],     "updates": [       {         "geometry": {           "x": -149.450,           "y": 60.120         },         "attributes": {           "OBJECTID": 50,           "datetime": 1272210710000,           "region": "Andreanof Islands, Aleutian Islands, Alaska"         }       }     ],     "deletes": [       19,23     ]   },   {     "id": 1,     "deletes": [       34,44     ]   } ]

响应结构

字段 类型 说明
id int 图层 ID
addResults EditResult[] 添加结果
updateResults EditResult[] 更新结果
deleteResults EditResult[] 删除结果
success boolean 是否成功
globalId int 全局 ID
error String 当失败时返回的错误提示
objectId int 对象 ID

响应示例

对 ArcGIS applyEdits 资源:http://localhost:8090/iserver/services/data-BeijingAddress/arcgisrest/BeijingAddress/FeatureServer/applyedits 执行 POST 请求,对图层要素进行编辑,请求体需包含参数如下 :

edits=[

  {

    "id" : 0,

    "adds" : [

      {

        "geometry" : {

        "x": -143.501,

        "y": 57.043000000000006

        },

        "attributes": {

          "datetime": 1272210710000,

          "depth": 31.100000000000001,

          "region": "Andreanof Islands, Aleutian Islands, Alaska"

        }

      },

      {

        "geometry": {

          "x": -72.865099999999927,

          "y": -37.486599999999953

        },

        "attributes": {

          "datetime": 1272210142999,

          "depth": "40.x",

          "region": "Bio-Bio, Chile"

        }

      }

    ],

    "updates": [

      {

        "geometry": {

          "x": -149.450,

          "y": 60.120

        },

        "attributes": {

          "OBJECTID": 50,

          "datetime": 1272210710000,

          "region": "Andreanof Islands, Aleutian Islands, Alaska"

        }

      }

    ],

    "deletes": [

      19,23

    ]

  },

  {

    "id": 1,

    "deletes": [

      34,44

    ]

  }

]

则返回的 pjson 格式的资源表述如下:

[

    {

        "id": 0,

        "addResults": [

            {

                "success": true,

                "globalId": "13488",

                "error": null,

                "objectId": 13488

            },

            {

                "success": true,

                "globalId": "13489",

                "error": null,

                "objectId": 13489

            }

        ],

        "updateResults": [{

            "success": false,

            "globalId": null,

            "error": null,

            "objectId": 0

        }],

        "deleteResults": [

            {

                "success": true,

                "globalId": "19",

                "error": null,

                "objectId": 19

            },

            {

                "success": true,

                "globalId": "23",

                "error": null,

                "objectId": 23

            }

        ]

    },

    {

        "id": 1,

        "addResults": [],

        "updateResults": [],

        "deleteResults": [

            {

                "success": true,

                "globalId": "34",

                "error": null,

                "objectId": 34

            },

            {

                "success": true,

                "globalId": "44",

                "error": null,

                "objectId": 44

            }

        ]

    }

]

HEAD 请求

返回跟 GET 请求一样的 HTTP 响应头,但是没有响应实体。可以在不必传输整个响应内容的情况下,获取包含在响应消息头中的元数据信息。元数据信息包括媒体类型,字符编码,压缩编码,实体内容长度等。

HEAD 请求可以用来判断 applyEdits 资源是否存在,或者客户端是否有权限访问 applyEdits 资源。通过对加.<format>的 URI 执行 HEAD 请求,还可以快速判断 applyEdits 资源是否支持<format>格式的表述。

请参见