首页 / 浏览问题 / 云GIS / 问题详情
怎样通过iclient增加点数据集
209EXP 2018年06月11日

我们可以通过地物编辑,增加面数据集,我们怎样通过iclient 对点数据集进行操作呢???

我自己根据地物编辑,增加面数据集  改写了一下程序:



使用的url如下:
url1="http://localhost:8090/iserver/services/map-supermap_oracle_lqk/rest/maps/Countries@World",
url2="http://localhost:8090/iserver/services/data-supermap_oracle_lqk/rest/data/datasources/SUPERMAP_ORACLE_FOREVER_RISKCONTROL/datasets/RISKMAP_DISASTER2_1/",
url3="http://localhost:8090/iserver/services/data-supermap_oracle_lqk/rest/data/";

点击页面  结果报:

1个回答

您好,你url那里换成点数据集吗?你应该还是用的范例里的面数据集吧
4,524EXP 2018年06月12日

url1  只是地图显示的面数据集,我是在重新定义的

vectorLayer = new SuperMap.Layer.Vector("Vector Layer");

然后在vectorLayer 图层上进行打点操作,如下

drawPoint = new SuperMap.Control.DrawFeature(vectorLayer, SuperMap.Handler.Point);
 drawPoint.events.on({"featureadded":addPointFeatureCompleted});

我的url2使用的就是点数据集

url2="http://localhost:8090/iserver/services/data-supermap_oracle_lqk/rest/data/datasources/SUPERMAP_ORACLE_FOREVER_RISKCONTROL/datasets/RISKMAP_DISASTER2_1"

这个应该不会有问题吧

换成点数据集之后依然报同样的错误。

这个地物编辑操作面时,geometry.id = "100000";

而操作点时  geometry.id = "SuperMap.Geometry.Point_85";

并且操作点时geometry下面没有components  选项

功能没有问题,检查你自己的代码

<script type="text/javascript">
        var host = document.location.toString().match(/file:\/\//) ? "http://localhost:8090" : 'http://' + document.location.host;
        var map, local, layer, vectorLayer, drawPoint, drawPolygon, dataUrl, ids, modifyFeature,
            url1 = host + "/iserver/services/map-jingjin/rest/maps/京津地区土地利用现状图",
            url2 = host + "/iserver/services/data-jingjin/rest/data/datasources/name/Jingjin/datasets/name/BaseMap_P/";
        function init() {
            layer = new SuperMap.Layer.TiledDynamicRESTLayer("京津", url1, { transparent: true, cacheEnabled: false }, { maxResolution: "auto", bufferImgCount: 0 }); 
            layer.events.on({ "layerInitialized": addLayer });
            vectorLayer = new SuperMap.Layer.Vector("Vector Layer");
            drawPoint = new SuperMap.Control.DrawFeature(vectorLayer, SuperMap.Handler.Point);
            drawPoint.events.on({ "featureadded": addFeatureCompleted });
            map = new SuperMap.Map("map", {controls: [drawPoint]});
        }

        function addLayer() {
            map.addLayers([layer, vectorLayer]);
            map.setCenter(new SuperMap.LonLat(117, 40), 0);
        }
        //激活添加地物
        function activateAddFeature() {
            drawPoint.activate();
        }
        //执行添加地物
        function addFeatureCompleted(drawGeometryArgs) {
            drawPoint.deactivate();
            var geometry = drawGeometryArgs.feature.geometry,
            feature = new SuperMap.Feature.Vector();
            feature.geometry = drawGeometryArgs.feature.geometry,
            vectorLayer.addFeatures(feature);
            geometry.id = "100000";
            var editFeatureParameter,
                editFeatureService,
                features = {
                    fieldNames: [],
                    fieldValues: [],
                    geometry: geometry
                };
            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);
        }
        //添加地物成功
        function addFeaturesProcessCompleted(editFeaturesEventArgs) {
            var addResultIds = editFeaturesEventArgs.result.IDs,
                resourceInfo = editFeaturesEventArgs.result.resourceInfo;
            if (addResultIds === null && resourceInfo === null) return;
            if ((addResultIds && addResultIds.length > 0) || (resourceInfo && resourceInfo.succeed)) {
                alert("新增地物成功");
                //重新加载图层
                layer.redraw();
            } else {
                alert("新增地物失败");
            }
        }
        function processFailed(e) {
            alert(e.error.errorMsg);
        }

    </script>

请问一下,这个对制作的点数据,有什么特殊要求吗??

我自己制作的点数据不能进行地物编辑

这是我的数据集的信息:

没有特殊要求,我就用的范例数据,你数据服务开可编辑了吗?

我创建的时候都选择“允许编辑”了,就是使用范例数据是没有问题的,自己制作的点数据,就会报上述错误,

我自己的点数据是通过桌面工具进行导入oracle数据库中的属性数据,然后转成的点数据,坐标系也转换成了WGS1984,。
...