首页 / 浏览问题 / 桌面GIS / 问题详情
添加元素时,提示500和404错误
7EXP 2017年05月15日

在新增/编辑保存元素时,提示如下错误:

code: 500

errorMsg: "the number of 'fieldNames' and 'fieldValues' are not equal or Geometry is null"

F12跟踪了下代码,如截图,没发现那里有错误。

其中fieldNames和fieldValues两个数组的值数量相等且对应,Geometry也不为空。

在代码中,为新增/编辑元素服务添加了监听,

var editFeatureService = new SuperMap.REST.EditFeaturesService(
    restUrl, {
        eventListeners : {
            "processCompleted" : importFeatureProcessCallBack,
            "processFailed" : processFailedImport
        }
    });

理论上,对于该服务的进去要么只进入processCompleted的监听,要么只进入processFailed的监听,可跟踪后发现,这两个监听都进去过了,于是造成进入processFailed失败时的监听弹出上述中的错误提示,而进入processCompleted的监听方法时弹出操作成功的提示,不明白是什么原因。

在此基础上,如果再次出发该功能进行新增/更新保存操作,会提示如下提示,404,提示资源不存在:

1个回答

您好,关于添加编辑地物的话,您可以参考以下demo:

http://support.supermap.com.cn:8090/iserver/iClient/forJavaScript/examples/examples.html#editFeature

您的问题可能就是没有正确的将drawgeometry中的geometry参数正确传入editfeature中。您可以对照demo中的方法修改。

程yan
1
1,695EXP 2017年05月15日
...