gpt4 book ai didi

gis - 在 OpenLayers 中查找点的坐标

转载 作者:行者123 更新时间:2023-12-04 01:21:17 27 4
gpt4 key购买 nike

如何在 OpenLayers 中获取 map 上特定点的坐标?

最佳答案

处理 map 上的点击事件 Click处理程序。这是onemany您可以在 OpenLayers 邮件列表文件中找到示例代码:

map.events.register('click', map, handleMapClick);

function handleMapClick(e)
{
var lonlat = map.getLonLatFromViewPortPx(e.xy);
// use lonlat

// If you are using OpenStreetMap (etc) tiles and want to convert back
// to gps coords add the following line :-
// lonlat.transform( map.projection,map.displayProjection);

// Longitude = lonlat.lon
// Latitude = lonlat.lat
}

关于gis - 在 OpenLayers 中查找点的坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2160725/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com