Circle: visible
visibleはCircleクラスのオプションです。円の表示状態を調整します。
値
boolean
trueなら表示状態、falseなら非表示状態になる。
var opts = {
visible: false ,
} ;
デモ
visibleを指定したデモです。
カスタム
var circle = new google.maps.Circle( {
map: map ,
center: map.getCenter() ,
radius: 8000 ,
visible: false ,
} ) ;
デフォルト
var circle = new google.maps.Circle( {
map: map ,
center: map.getCenter() ,
radius: 8000 ,
} ) ;
サンプルコード
<!DOCTYPE html>
<html>
<head>
<style>
#map-canvas {
width: 600px ;
height: 600px ;
}
</style>
</head>
<body>
<div id="map-canvas"></div>
<script src="//maps.googleapis.com/maps/api/js?key={APIキー}"></script>
<script>
var mapDiv = document.getElementById( "map-canvas" ) ;
// Map
var map = new google.maps.Map( mapDiv, {
center: new google.maps.LatLng( 35, 139 ) ,
zoom: 11 ,
} ) ;
// Circle
var circle = new google.maps.Circle( {
map: map ,
center: new google.maps.LatLng( 35, 139 ) ,
radius: 8000 ,
visible: false ,
} ) ;
// fit bounds
map.getBounds( circle.getBounds() ) ;
</script>
</body>
</html>