简体   繁体   中英

HERE Maps API for Javascript : how to get boundaries longitude and latitude from current zoom Visible Map

I am using the HERE Maps API for Javascript for the webpage: how to get boundaries longitude and latitude from current zoom Visible Map.

When the map display on the webpage is a rectangle shape, what is the method to get 4 boundaries points longitude and latitude in the visible area of Here maps?

Many thanks

It's much more complicated than it should be:

map.getViewModel().getLookAtData().bounds.getBoundingBox()

You'll get an object like that:

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. Therefore:

bb = map.getViewModel().getLookAtData().bounds.getBoundingBox();

bb.getTop(); 
bb.getLeft(); 
bb.getBottom(); 
bb.getRight();

// or 
bb.getTopLeft();
bb.getBottomRight();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM