Lin L
Lin L

Reputation: 13

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

Upvotes: 1

Views: 761

Answers (2)

Tomas
Tomas

Reputation: 1887

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();

Upvotes: 0

cweiske
cweiske

Reputation: 31147

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
}

Upvotes: 0

Related Questions