取得したいくつかのマーカーがあり、マップを中央に配置したいと考えています。はい、他のすべての回答を読みましたが、うまくいかないようです: Google Map API v3 - set bounds and center
JS:
geocoder.geocode( {'address': loc}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var markerBounds = new google.maps.LatLngBounds();
var coordinate = results[0].geometry.location;
var icon = new google.maps.MarkerImage("images/icon-"+type+".png", new google.maps.Size(37, 44));
//create the marker
var marker = new google.maps.Marker({
map: map,
position: coordinate,
visible: true,
id: type,
shadow: shadow,
icon: icon
});
markerBounds.extend(coordinate);
map.fitBounds(markerBounds);
}
}