ArcGIS Server 10.2 要素编辑Restful API 翻译

Apply Edits (Feature Service\Layer)

URL:http://<featureservice-url>/applyEdits(POST only)
Required Capability:Create,Update,Delete 
//Create required to add features, Update required to
 update features, and Delete required for deleting features.
Version Introduced:10.1

描述

此操作支持10.1以上版本。

此应用操作应用于多图层和多表格在一次操作中处理的情况。该操作应用于要素图层。返回的结果是一个数组里面存储的每个操作的结果。每个返回的操作对象表明了单个图层或者单个表格的操作是否成功。如果操作不成功操作结果会返回错误表示和描述。

你可以使用下面的表格中的参数来进行要素编辑操作。

请求参数

参数 f

细节 :
说明了返回的格式默认是HTML格式
Values: html | json

参数 edits

细节 :
Description: 一串要被编辑的图层数组

那些要被增加或者更新到一个要素图层中的要素必须包括geometry。
那些要被添加到表格中的记录不应该包括geometry。
那些被更新的要素,属性中应该包括object id以及其余的属性。

"attributes" : {
  "OBJECTID" : 37,
  "OWNER" : "Joe Smith",
  "VALUE" : 94820.37,
  "APPROVED" : true,
  "LASTUPDATE" : 1227667627940
}

语法

[
    { "id" : <layerId1>,
    "adds" : [<feature1>, <feature2>],
    "updates" : [<feature1>, <feature2>],
    "deletes" : [<objectID1>, <objectID2>]
    },
    { "id" : <layerId2>,
    "adds" : [<feature1>, <feature2>],
    "updates" : [<feature1>, <feature2>],
    "deletes" : [<objectID1>, <objectID2>]
    }  
]

示例

[
    {
         "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 
        ] 
    } 
]

参数 gdbVersion

细节 :

//这个属性实在10.1之后添加的
Geodatabase的版本。这个参数只有在该图层的isDataVersioned参数是true是起作用。如果参数不被注定则默认为发布地图的Geodatabase的版本。

Syntax:

 gdbVersion=<version>

Example:

 gdbVersion=SDE.DEFAULT

参数 rollbackOnFailure

细节 :

//这个属性实在10.1之后添加的
这个可选参数用于指定是否在所有的编辑全部成功时返回参数。如果参数为false则server将会返回全部参数即使有些编辑出错。如果是true那么server 将会应用编辑当所有的编辑成功的时候。默认值为true。

不是所有的数据支持这个参数,查询图层的supportsRollbackonFailureParameter属性来验证是否支持。如果supportsRollbackOnFailureParameter = false那么rollbackOnFailure始终未true,不论参数是如何设定的。

Values: true|false

Example:

rollbackOnFailure=true

使用案例

Example 1: Apply edits on a feature service resource

http://services.myserver.com/lidGgNLxw9LL0SbI/ArcGIS/rest/services/PoolPermits/FeatureServer/applyEdits

sample input for adds, represented by an array of features:

[
    {
        "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 
        ] 
    } 
]

JSON 返回语法

[
  {   
    "id" : <layerId1>,
    "addResults" : [
    {
      "objectId" : <objectId1>,
      "globalId" : <globalId1>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code1>,
        "description" : "<description1>",
      }
    },
    {
      "objectId" : <objectId2>,
      "globalId" : <globalId2>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code2>,
        "description" : "<description2>",
      }
    }
  ],
  "updateResults" : [
    {
      "objectId" : <objectId1>,
      "globalId" : <globalId1>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code1>,
        "description" : "<description1>",
      }
    },
    {
      "objectId" : <objectId2>,
      "globalId" : <globalId2>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code2>,
        "description" : "<description2>",
      }
    }
  ],
  "deleteResults" : [
    {
      "objectId" : <objectId1>,
      "globalId" : <globalId1>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code1>,
        "description" : "<description1>",
      }
    },
    {
      "objectId" : <objectId2>,
      "globalId" : <globalId2>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code2>,
        "description" : "<description2>",
      }
    }
  ]
},
{   
    "id" : <layerId2>,
    "addResults" : [
    {
      "objectId" : <objectId1>,
      "globalId" : <globalId1>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code1>,
        "description" : "<description1>",
      }
    },
    {
      "objectId" : <objectId2>,
      "globalId" : <globalId2>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code2>,
        "description" : "<description2>",
      }
    }
  ],
  "updateResults" : [
    {
      "objectId" : <objectId1>,
      "globalId" : <globalId1>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code1>,
        "description" : "<description1>",
      }
    },
    {
      "objectId" : <objectId2>,
      "globalId" : <globalId2>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code2>,
        "description" : "<description2>",
      }
    }
  ],
  "deleteResults" : [
    {
      "objectId" : <objectId1>,
      "globalId" : <globalId1>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code1>,
        "description" : "<description1>",
      }
    },
    {
      "objectId" : <objectId2>,
      "globalId" : <globalId2>,
      "success" : <true | false>,
      "error" : { //only if success is false
        "code" : <code2>,
        "description" : "<description2>",
      }
    }
  ]
}
]

JSON返回示例

[
 {
  "id": 0,
  "addResults": [
   {
    "objectId": 617,
    "globalId" : "{be6557a4-2204-4a66-a901-7295080003a6}",
    "success": true
   },
   {
    "success": false,
    "error": {
     "code": -2147217395,
     "description": "Setting of Value for depth failed."
    }
   }
  ],
  "updateResults": [
   {
    "objectId": 50,
    "globalId" : "{09b3b932-a75c-4438-837e-9a17f84113d5}",
    "success": true
   }
  ],
  "deleteResults": [
   {
    "objectId": 19,
    "success": true
   },
   {
    "objectId": 23,
    "success": true
   }
  ]
 },
 {
  "id": 1,
  "deleteResults": [
   {
    "objectId": 34,
    "success": true
   },
   {
    "objectId": 44,
    "success": true
   }
  ]
 }
]
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值