您好,可以参考这个范例https://iclient.supermap.io/examples/classic/editor.html#others_projection
通过这个获取鼠标位置的控件获取当前鼠标位置,然后监听浏览器的鼠标点击事件,点击后获取坐标。以官网的image图层加载为例可以修改成如下代码
var map, layer,control;
map = new SuperMap.Map("map", {
controls: [
new SuperMap.Control.ScaleLine(),
new SuperMap.Control.Zoom(),
new SuperMap.Control.LayerSwitcher(),
new SuperMap.Control.Navigation()]
});
var options = {numZoomLevels: 12, useCanvas: false};
var bounds = new SuperMap.Bounds(-180, -90, 180, 90);
layer = new SuperMap.Layer.Image(
'World_Day',
'images/Day.jpg',
bounds,
options
);
map.addLayer(layer);
map.zoomToMaxExtent();
control = new SuperMap.Control.MousePosition();
map.events.on({"click": getMousePositionPx});
function getMousePositionPx(evt) {
//获取鼠标坐标位置
var lonLat = map.getLonLatFromPixel(evt.xy);
console.log(lonLat);
if (!lonLat) {
return;
}
}