arcgis api 3.x for js 入门开发系列十九图层在线编辑

前言

关于本篇功能实现用到的 api 涉及类看不懂的,请参照 esri 官网的 arcgis api 3.x for js:esri 官网 api,里面详细的介绍 arcgis api 3.x 各个类的介绍,还有就是在线例子:esri 官网在线例子,这个也是学习 arcgis api 3.x 的好素材。

本篇主要讲述的是利用 arcgis api 3.x 实现图层在线编辑功能模块,效果图如下:




 

实现思路

  • arcgis serve r发布的 FeatureServer 服务提供的图层在线编辑能力
  • 实现的在线编辑(增删改),主要是通过前端 ajax 请求后台 FeatureServer 服务来实现的
  1. http://120.199.78.138:6080/arcgis/rest/services/dlsde/FeatureServer/0/updateFeatures
public void ProcessRequest (HttpContext context) {
string featureserverurl = context.Request.Params["featureserverurl"];
string features = context.Request.Params["features"];
string param = "features=" + features + "&f=json";
string url = featureserverurl + "/updateFeatures";
string ret = PostDataToUrl(param, url, "application/x-www-form-urlencoded");
 
context.Response.Write(ret);
}

  1. http://120.199.78.138:6080/arcgis/rest/services/dlsde/FeatureServer/0/addFeatures
public void ProcessRequest (HttpContext context) {
string featureserverurl = context.Request.Params["featureserverurl"];
string features = context.Request.Params["features"];
string param = "features=" + features + "&f=json";
string url = featureserverurl + "/addFeatures";
string ret = PostDataToUrl(param, url, "application/x-www-form-urlencoded");
 
context.Response.Write(ret);
}

  1. http://120.199.78.138:6080/arcgis/rest/services/dlsde/FeatureServer/0/deleteFeatures
public void ProcessRequest (HttpContext context) {
string featureserverurl = context.Request.Params["featureserverurl"];
string id = context.Request.Params["OBJECTID"];
string param = "where=OBJECTID=" + id + "&f=json";
string url = featureserverurl + "/deleteFeatures";
string ret = PostDataToUrl(param, url, "application/x-www-form-urlencoded");
 
context.Response.Write(ret);
context.Response.End();
}

  • 前端 ajax 请求

更多的详情见GIS之家小专栏

对本专栏感兴趣的话,可以关注一波

 

posted @ 2018-03-18 13:48  GIS之家  阅读(3788)  评论(2编辑  收藏  举报