获取当前鼠标的坐标,然后转换坐标,然后构造点对象,最后GetFeaturesByGeometryParameters查询返回“GetFeaturesByGeometryParameters”, 可是传入的geometry不是空的啊。在iserver里面又可以查出来。
var latlng = event.latlng;
var point_old = L.latLng(event.latlng.lat,event.latlng.lng);
var point_new = L.CRS.EPSG3857.project(point_old);
var point = L.point(point_new.x, point_new.y);
// var geometry = new SuperMap.Geometry.Point(point_new.x, point_new.y);
// var point = {"points":[{"y": 100, "x": 30}],"type":"POINT"};
// var geometry = eval(point);
var geometryParam = new SuperMap.GetFeaturesByGeometryParameters({
datasetNames: ["all:test"],
geometry: point,
spatialQueryMode: "INTERSECT"
});
L.supermap
.featureService(dataUrl)
.getFeaturesByGeometry(geometryParam, function (serviceResult) {
console.log('serviceResult:', serviceResult);
// resultLayer = L.geoJSON(serviceResult.result.features, {
// onEachFeature: function (feature, layer) {
// layer.bindPopup(resources.text_country + ":" + feature.properties.COUNTRY);
// }
// }).addTo(map);
});
求大神指点---在线等