首页 / 浏览问题 / 云GIS / 问题详情
如何通过点做缓冲区分析
4EXP 2017年06月26日
iclient for javascript如何通过点做缓冲区分析呢?示例代码中只有线缓冲,查了好几天也没弄明白[心塞],点缓冲具体代码应该怎么写呢

1个回答

您好!点缓冲区分析和线缓冲区分析差不多,唯一的区别就是点缓冲区分析只需要设置地物的左侧缓冲距离即可,并且缓冲区端点类型只能为圆头缓冲。
663EXP 2017年06月26日
function bufferAnalystProcess() {
                if (nodeArray.length ==0) {
                    alert("请选择位置点!");
                    return;
                }
                var bufferServiceByGeometry = new SuperMap.REST.BufferAnalystService(url2),
                        bufferDistance = new SuperMap.REST.BufferDistance({
                            value: 500
                        }),
                        bufferSetting = new SuperMap.REST.BufferSetting({
                            endType: SuperMap.REST.BufferEndType.ROUND,
                            leftDistance: bufferDistance
                        }),
                        geoBufferAnalystParam = new SuperMap.REST.GeometryBufferAnalystParameters({
                            geometry: nodeArray,
                            bufferSetting: bufferSetting
                        });

                bufferServiceByGeometry.events.on(
                        {
                            "processCompleted": bufferAnalystCompleted
                        });
                bufferServiceByGeometry.processAsync(geoBufferAnalystParam);
            }
            function bufferAnalystCompleted(BufferAnalystEventArgs) {
                var feature = new SuperMap.Feature.Vector();
                bufferResultGeometry = BufferAnalystEventArgs.result.resultGeometry;
                feature.geometry = bufferResultGeometry;
                feature.style = styleRegion;
                resultLayer.addFeatures(feature);
            }

所以这么写是没问题的,不能实现是别的地方出错了是吗
单看你这段代码看不出什么问题,你实现的时候是不出结果还是怎么回事儿,具体的你可以看一下报错;其次你把这些参数拿到服务端去分析一下,看看能不能分析成功!
...