首页 / 浏览问题 / 其他 / 问题详情
editFeatures 把要素属性信息保存到数据集
10EXP 2020年05月08日
点数据集服务  新建属性信息 ,传参数就报错  求帮忙!!!

               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);
                });

1个回答

传入的对象有误,添加点数据的话使用L.circle的方法去构造点,radius设置为0即可。已发送demo
1,686EXP 2020年05月09日
...