editFeatures 把要素属性信息保存到数据集

0 投票
点数据集服务  新建属性信息 ,传参数就报错  求帮忙!!!

               var featureService = L.supermap.featureService(url);

                //alert("featureService:"+featureService);
                
                //制作feature
                var geometry = new SuperMap.Geometry.Point(longitude,latitude);
                 var style = {
                     strokeColor:"#339933",
                     strokeOpacity:1,
                     strokeWidth:3,
                     pointRadius:6
                 };
                 var attr = {
                    // fieldNames: ['BH','MC','X','Y'],
                    // fieldValues: ['111111',namea,longitude,latitude],
                    fieldNames: ['MC'],
                    fieldValues: ['aa'],
                     geometry:geometry
                 };
                 alert("longitude:"+longitude+"----latitude:"+latitude);
                 var pointFeature = new SuperMap.Feature.Vector(geometry,attr,style);

                //设置地物编辑字段参数
                var addFeatureParams = new SuperMap.EditFeaturesParameters({
                    dataSourceName: "sqlsource",
                    dataSetName: "LDG_PT",
                    features: [attr],
                    editType: SuperMap.REST.EditType.ADD,
                    returnContent: true
                });
                //使用地物编辑服务向服务端发送请求并获取数据
                featureService.editFeatures(addFeatureParams, function (serviceResult) {
                     // 获取返回数据
                     debugger;
                    var result = serviceResult.result;
                     alert("serviceResult:"+result);
                });
5月 8 分类:  47次浏览 | 用户: 白色猪 (8 分)

1个回答

0 投票
传入的对象有误,添加点数据的话使用L.circle的方法去构造点,radius设置为0即可。已发送demo
5月 9 用户: 李俊霖 名扬四海 (1,345 分)
...