insert接口
URL: |
http:// <FeatureServer-URL> / insert |
父资源: |
FeatureServer |
[ 服务说明 ]
insert接口规定了对FeatureServer数据源进行增加要素操作的请求参数格式。
[ 参数说明 ]
参数 | 参数说明 |
---|---|
format |
参数作用:指定服务请求返回结果的格式 取值范围:html | json ,该参数默认值为html |
layer |
参数作用:指定要增加要素的图层名称 参数说明:insert接口只能针对单图层增加要素,layer参数只能设置为一个图层名称 |
features |
参数作用:查询条件 参数说明:features参数格式如下: [ { "geometry": { "type":"Polygon","coordinates":[[[86.22193718749995,53.880950312500005],[133.76295281249995,53.837981562500005],[111.18873406249995,29.246184687500005],[86.22193718749995,39.880950312500005]],[86.22193718749995,53.880950312500005]] }, "attributes": { "名称":"KK" } }, { "geometry": { "type":"Polygon","coordinates":[[[86.22193718749995,53.880950312500005],[133.76295281249995,53.837981562500005],[111.18873406249995,29.246184687500005],[86.22193718749995,39.880950312500005]],[86.22193718749995,53.880950312500005]] }, "attributes": { "名称":"FF" } } ] |
callback |
参数作用:Ajax客户端使用JSONP方式进行跨域处理时所指定的回调函数名称 参数说明:可选参数,该参数仅在format参数值为json时有效 |
[ 示例 ]
feature请求接口示例:
http://127.0.0.1:8099/newmap/rest/services/samples/china/FeatureServer/insert?layer=首都和省级行政中心&format=json&features=<featureStr>
[ 返回结果 ]
insert操作成功时的返回结果示例 :
{
"InsertResults":[
{"FID":"925","success":true},
{"FID":"926","success":true}
]
}
"InsertResults":[
{"FID":"925","success":true},
{"FID":"926","success":true}
]
}
insert操作失败时的返回结果示例 :
{
"exceptionCode":"400",
"exceptionText":"features参数无效"
}
或者:
{
"InsertResults":[
{"FID":"-1","success":false,"error":{"code":400,"description":"服务数据源不存在名称为NAME的字段"}},
{"FID":"-1","success":false,"error":{"code":400,"description":"服务数据源不存在名称为NAME的字段"}}
]
}
"exceptionCode":"400",
"exceptionText":"features参数无效"
}
或者:
{
"InsertResults":[
{"FID":"-1","success":false,"error":{"code":400,"description":"服务数据源不存在名称为NAME的字段"}},
{"FID":"-1","success":false,"error":{"code":400,"description":"服务数据源不存在名称为NAME的字段"}}
]
}