你好,我使用地物编辑功能,在 featureService.editFeatures(addFeatureParams, function (serviceResult) {
处,使用 var result23 = serviceResult.result; 获取结果是提示undefine。请问怎么解决
js报
Uncaught DeveloperError: normalized result is not a number
Error
at new t (eval at <anonymous> (http://localhost:8090/Bitnet_3DMap/Build/Cesium/Cesium.js:25:1), <anonymous>:1:3391)
at Function.a.normalize (eval at <anonymous> (http://localhost:8090/Bitnet_3DMap/Build/Cesium/Cesium.js:25:1), <anonymous>:1:52205)
at Function.a.fromRadians (eval at <anonymous> (http://localhost:8090/Bitnet_3DMap/Build/Cesium/Cesium.js:25:1), <anonymous>:1:55681)
代码如下:
<link href="../Build/Cesium/Widgets/widgets.css" rel="stylesheet">
<link href="./css/pretty.css" rel="stylesheet">
<script src="./js/jquery.min.js"></script>
<script src="./js/config.js"></script>
<script src="./js/supermap/SuperMap.Include.js"></script>
<script type="text/javascript" src="../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript" src="./js/require.min.js" data-main="js/main"></script>
<style>
input[type=text]{
TEXT-ALIGN: center;
z-index: 3;
height: 18px;
background: none;
border: none;
padding: 5px 0;
-webkit-transition: 0.3s;
transition: 0.3s;
border-bottom: 2px solid #b8b2b2;
color: aliceblue;
}
</style>
</head>
<body class="loading">
<div id="cesiumContainer"></div>
<div id="toolbar" class="param-container tool-bar">
<label style="font: 400 13.3333px Arial;">SQL</label><input type="text" id="SQL" value="SMID>1">
<button type="button" id="search" class="button black">查询</button>
<button type="button" id="add" class="button black">添加</button><br>
<select id="position" style="width: 100%">
<option value ="1">路灯杆</option>
<option value ="2">定位点2</option>
<option value="3">定位点3</option>
<option value="4">点位点4</option>
</select>
</div>
<div id="bubble" class="bubble" >
<div id="tools" style="text-align : right">
<span class="fui-cross" title="关闭" id="close" style="color: darkgrey;padding:5px"></span>
</div>
<div style="overflow-y:scroll;height:150px" id="tableContainer"><table id="tab"></table></div>
</div>
<script>
function onload(Cesium) {
$("#add").click(function(){
alert("add");
//实例化地物编辑服务
// var url="
https://iserver.supermap.io/iserver/services/data-world/rest/data";
var url = 'http://localhost:8090/iserver/services/data-sql_search/rest/data';
alert("111");
var xmax = 120, xmin = 100, ymax = 50, ymin = 20,
point = [];
point = [
Math.floor(Math.random() * (ymax - ymin + 1) + ymin),
Math.floor(Math.random() * (xmax - xmin + 1) + xmin)
];
var marker = L.circleMarker(point, {color: "red"});
alert("marker:"+marker);
var featureService = L.supermap.featureService(url);
alert("featureService:"+featureService);
//设置地物编辑字段参数
var addFeatureParams = new SuperMap.EditFeaturesParameters({
dataSourceName: "qlsource",
dataSetName: "LDG_PT",
features: marker,
editType: "add",
returnContent: true
});
//使用地物编辑服务向服务端发送请求并获取数据
featureService.editFeatures(addFeatureParams, function (serviceResult) {
// 获取返回数据
// var result23 = serviceResult.result;
alert("serviceResult:"+serviceResult);
alert("serviceResult.result:"+serviceResult.result);
// alert("serviceResult.length:"+serviceResult.length);
});
});