Google Maps v3 (javascript)를 사용하고 있습니다.Google지도에서 직사각형을 제거
<script type="text/javascript">
// Global variables
var map;
/**
* Called on the initial page load.
*/
function init() {
map = new google.maps.Map(document.getElementById('map'), {
'zoom': 6,
'center': new google.maps.LatLng(41.87194,12.567379999999957),
'mapTypeId': google.maps.MapTypeId.ROADMAP
});
//Region Overlay
var latLng1;
var latLng2;
<?php foreach ($this->arrRegion as $region) { ?>
latLng1 = new google.maps.LatLng(<?php echo $region['boundLat1_region']; ?>,<?php echo $region['boundLng1_region']; ?>);
latLng2 = new google.maps.LatLng(<?php echo $region['boundLat2_region']; ?>,<?php echo $region['boundLng2_region']; ?>);
redraw(latLng1,latLng2);
<?php }?>
}
/**
* Updates the Rectangle's bounds to resize its dimensions.
*/
function redraw(latLng1,latLng2) {
var latLngBounds = new google.maps.LatLngBounds(latLng1,latLng2);
// Create a new Rectangle overlay
var rectangle = new google.maps.Rectangle({map: map, bounds: latLngBounds});
}
// Register an event listener to fire when the page finishes loading.
google.maps.event.addDomListener(window, 'load', init);
</script>
지금 내 목표는 사각형을 제거하는 것입니다 : 내지도를로드 할 때 나는 다음과 같은 방법으로 사각형을 그립니다. map.clear를 사용하려고했지만 작동하지 않았습니다. 어떠한 제안?