<!DOCTYPE html>
<html>
<head>
<title>Tạo Ractangle</title>
<meta charset="utf-8" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
</head>
<body>
   <div>
        <div id="divMap" style="width:800px; height:400px"></div>

 </div>
<script src="https://gisapi.tphcm.gov.vn/developers/Scripts/HCMMapsAPI2.js?key=fd671b71-2ea6-4fb6-bd19-0651a87087ae" type="text/javascript"></script>
<script>

function initialize(){

/*key=ABCDEFG Bạn phải thay ABCDEFG bằng key mà bạn đăng ký */
/*Tạo property cho map*/

  var mapProp = {
      center: new hcmmap.LatLng(10.8152328, 106.680505),
      zoom: 10
  };

/*Tạo map object với property(mapProp)*/
  var map = new hcmmap.Map(document.getElementById("divMap"), mapProp);


 var boundmap = map.getBounds();
 var myrect = new hcmmap.Rectangle({ bounds: boundmap });
 myrect.setMap(map);
 map.setZoom(map.getZoom() - 2);
}

/*Khởi động map sau khi page load xong*/

hcmmap.event.addDomListener(window, 'load', initialize);

</script>
</body>
</html>