MapShape.getBoundsRec

Syntax

getBoundsRec();

Description

The getBoundsRec method returns a rectangular shape bounding map layer area.

Comments

The method returns a JSON object.

Example

To execute the example the HTML page must contain the MapChart component named map (see Example of Creating the MapChart Component). Draw a rectangle bounding map layer area with the RU-KYA identifier:

// Get map layer area with the ID RU-KYA
var shape = map.getShape("RU-KYA");
// Get rectangular shape bounding map layer area
var bounds = shape.getBoundsRect();
// Draw a rectangle bounding this region
var rect = PP.SVG.rect(shape.getParentLayer().getDomNode());
PP.SVG.setAttr(rect, {
    'x': bounds.getLeft(),
    'y': bounds.getTop(),
    'width': bounds.getWidth(),
    'height': bounds.getHeight(),
    'opacity': 0.5
});

After executing the example a rectangle is drawn bounding map layer area with the RU-KYA identifier:

See also:

MapShape