Search code examples
javascriptgeolocationmapshere-apiheremaps

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


Solution

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