首页 / 浏览问题 / 云GIS / 问题详情
Iclient Leaflet 点判断在哪个面里
125EXP 2020年02月24日
 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);
            });
    }

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

1个回答

您好,需要修改代码

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进行查询

5,668EXP 2020年02月24日
好的,谢谢,我看技术文档里没有marker这种类型就没这样测试。我试着把marker转换成geoJSON格式也可以
...