首页 / 浏览问题 / WebGIS / 问题详情
GetFeaturesByBoundsParameters范围查询结果不对
6EXP 2024年03月20日

GetFeaturesByBoundsParameters范围查询,方框就是范围,模式是相交。为什么最后的结果既有旁边横的线,又有旁边竖的线呢。


//pointGeomerty:中心点
//bounds1:查询范围
var bounds1 = new SuperMap.Bounds(pointGeomerty.x - 1, pointGeomerty.y -1, pointGeomerty.x + 1, pointGeomerty.y + 1);
        var GetFeaturesByBoundsParameters, getFeaturesByGeometryService;

        // 创建矩形图形
        var points = [
            new SuperMap.Geometry.Point(bounds1.left, bounds1.bottom),
            new SuperMap.Geometry.Point(bounds1.left, bounds1.top),
            new SuperMap.Geometry.Point(bounds1.right, bounds1.top),
            new SuperMap.Geometry.Point(bounds1.right, bounds1.bottom)
        ];
        points.push(points[0]); // 确保多边形闭合

        var linearRing = new top.SuperMap.Geometry.LinearRing(points);
        var polygonFeature = new top.SuperMap.Feature.Vector(new SuperMap.Geometry.Polygon([linearRing]));
        // 将查询范围作为矩形添加到地图上
        crossLayer.addFeatures(polygonFeature);
        
        GetFeaturesByBoundsParameters = new SuperMap.REST.GetFeaturesByBoundsParameters({
            datasetNames: [Freedom.App.prefix.replace("@", '') + ":" + roadTable],
            spatialQueryMode: SuperMap.REST.SpatialQueryMode.INTERSECT,
            bounds: bounds1
        });
        getFeaturesByGeometryService = new SuperMap.REST.GetFeaturesByBoundsService(dataUrl, {
            eventListeners: {
                "processCompleted": queryCompleted,
                "processFailed": processFailed
            }
        });
        getFeaturesByGeometryService.processAsync(GetFeaturesByBoundsParameters);

1个回答

您好,您用是是什么版本的iClient?然后您的底图是什么坐标系?
446EXP 2024年03月20日

(1)iClient10i。

(2)并且在iserver10i中查数据,发现并没有空间查询模式这个参数。

(3)问题解决:改为使用缓冲区查询GetFeaturesByBufferService就正常获得结果了,

iServer 10.2.1版本是有空间查询模式,如果您使用的版本没有,可以升级到10.2.1

好,谢谢
...