首页 / 浏览问题 / 云GIS / 问题详情
editFeatures 怎么把要素新建的属性信息保存到数据集中?
10EXP 2020年03月08日

面数据集服务  新建属性信息  前端保存绘制的多边形时,传参数就报错  求帮忙!!!

1个回答

可以参考

function addFeatureCompleted(drawGeometryArgs) {
        var points = [
                    new SuperMap.Geometry.Point(116.86186644483,41.046830100301),
                    new SuperMap.Geometry.Point(116.65000797215, 40.654268812689),
                    new SuperMap.Geometry.Point(117.99593238682,40.448641471558),
                    new SuperMap.Geometry.Point(116.86186644483, 41.046830100301)

                ],
                linearRings = new SuperMap.Geometry.LinearRing(points),
                region = new SuperMap.Geometry.Polygon([linearRings]);
                var polygonVector = new SuperMap.Feature.Vector(region);
         vectorLayer.addFeatures(polygonVector);
        region.id = "100000";
        var editFeatureParameter,
            editFeatureService,
            features = {
                fieldNames: ['NAME'],
                fieldValues: ['aaa'],
                geometry: region
            };
        editFeatureParameter = new SuperMap.REST.EditFeaturesParameters({
            features: [features],
            editType: SuperMap.REST.EditType.ADD,
            returnContent: false
        });
        editFeatureService = new SuperMap.REST.EditFeaturesService(url2, {
            eventListeners: {
                "processCompleted": addFeaturesProcessCompleted,
                "processFailed": processFailed
            }
        });
        editFeatureService.processAsync(editFeatureParameter);
    }

根据官网范例简单写了一个功能,添加结束后会有对应的结果被打印出来

于浩
1
5,668EXP 2020年03月09日

vectorLayer.addFeatures(polygonVector);

其中这个vectorLayer 是指什么?  怎么声明?

根据您的参考可以成功把绘制的多边形要素保存到服务了,现在需要修改已保存的多边形要素的形状,整不出来迷茫中angel(如下图鼠标拖动修改的方式)

...