1.坐标转换
//地理坐标转屏幕坐标
const coordinate = [-122.420679, 37.772537];
const point = map.project(coordinate);
//屏幕坐标转地理坐标
map.on('click', (e) => {
// When the map is clicked, get the geographic coordinate.
const coordinate = map.unproject(e.point);
});
1.坐标转换
//地理坐标转屏幕坐标
const coordinate = [-122.420679, 37.772537];
const point = map.project(coordinate);
//屏幕坐标转地理坐标
map.on('click', (e) => {
// When the map is clicked, get the geographic coordinate.
const coordinate = map.unproject(e.point);
});