![](/img/trans.png)
[英]Here Maps api: how to get current center showing on the map (JavaScript)
[英]HERE Maps API for Javascript : how to get boundaries longitude and latitude from current zoom Visible Map
我正在使用 HERE Maps API for Javascript 作为网页:如何从当前缩放可见 Map 获取边界经度和纬度。
当网页上的map显示为矩形时,Here地图可视区域的4个边界点经纬度的获取方法是什么?
非常感谢
它比应有的复杂得多:
map.getViewModel().getLookAtData().bounds.getBoundingBox()
你会得到一个像这样的 object :
Object {
ba: 12.375232332750691,
ga: 12.379826130043003,
ja: 51.33821375191854,
ka: 51.337248429832854,
b: null, a: null, c: null
}
As per the documentation , the bounds object in getLookAtData method for ViewModel is a bounding box in 2D map and a polygon in 3D map. 所以:
bb = map.getViewModel().getLookAtData().bounds.getBoundingBox();
bb.getTop();
bb.getLeft();
bb.getBottom();
bb.getRight();
// or
bb.getTopLeft();
bb.getBottomRight();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.