// 表示している地図の端の座標を取得する
var extent = map.getView().calculateExtent(map.getSize());
var bottomLeft = ol.proj.transform(ol.extent.getBottomLeft(extent),
'EPSG:3857', 'EPSG:4326');
var topRight = ol.proj.transform(ol.extent.getTopRight(extent),
'EPSG:3857', 'EPSG:4326');
var endof_left = wrapLon(bottomLeft[0]);
var endof_bottom = bottomLeft[1];
var endof_right = wrapLon(topRight[0]);
var endof_top = topRight[1];
console.log(endof_left);
console.log(endof_bottom);
console.log(endof_right);
console.log(endof_top);
function wrapLon(value) {
var worlds = Math.floor((value + 180) / 360);
return value - (worlds * 360);
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
11