![](/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.