Circle: radius
radiusはCircleクラスのオプションです。円の半径を調整します。
値
number
メートルを表す数値を指定する。
var opts = {
radius: 800 ,
} ;
デモ
radiusを指定したデモです。メートル単位で円の半径に反映されます。
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 ,
} ) ;
// fit bounds
map.getBounds( circle.getBounds() ) ;
</script>
</body>
</html>