Iclient Leaflet 点判断在哪个面里

0 投票
 function query() {
        var point1 = new SuperMap.Geometry.Point(121,37);
        var geometryParam = new SuperMap.GetFeaturesByGeometryParameters({
            datasetNames: ["World:Countries"],
            geometry: point1,
            spatialQueryMode: "INTERSECT"
        });
        L.supermap
            .featureService(url)
            .getFeaturesByGeometry(geometryParam, function (serviceResult) {
                resultLayer = L.geoJSON(serviceResult.result.features, {
                    onEachFeature: function (feature, layer) {
                        layer.bindPopup(resources.text_country + ":" + feature.properties.COUNTRY);
                    }
                }).addTo(map);
            });
    }

请问想判断点在哪个面要素内,这样写不可以吗?但是运算不出来,报错

2月 24 分类:  103次浏览 | 用户: palette 初出茅庐 (98 分)
重新分类 2月 24 用户:邬袁凯

1个回答

0 投票
 
已采纳

您好,需要修改代码

function query() {
        var geometryParam = new SuperMap.GetFeaturesByGeometryParameters({
            datasetNames: ["World:Countries"],
            geometry: L.marker([39, 116]),
            spatialQueryMode: "INTERSECT"
        });
        L.supermap
            .featureService(url)
            .getFeaturesByGeometry(geometryParam, function (serviceResult) {
                console.log(serviceResult);
                resultLayer = L.geoJSON(serviceResult.result.features, {
                    onEachFeature: function (feature, layer) {
                        layer.bindPopup(resources.text_country + ":" + feature.properties.COUNTRY);
                    }
                }).addTo(map);
            });
    }

将point改成L.marker进行查询

2月 24 用户: 于浩 登峰造极 (5,662 分)
采纳于 2月 24 用户:palette
好的,谢谢,我看技术文档里没有marker这种类型就没这样测试。我试着把marker转换成geoJSON格式也可以
...