var map = new GMap2(document.getElementById("map")); var geocoder = new GClientGeocoder(); var one; var two;
geocoder.getLocations( "港区赤坂5-3-6", function(locations) { if (!locations || locations.Status.code != 200) { alert(address + " not found"); } else { var place = locations.Placemark[0]; var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); one = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); map.setCenter(point, 16); var marker = new GMarker(point); map.addOverlay(marker); } } ); geocoder.getLocations( "港区東新橋1-6-1", function(locations) { if (!locations || locations.Status.code != 200) { alert(address + " not found"); } else { var place = locations.Placemark[0]; var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); two = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); var marker = new GMarker(point); map.addOverlay(marker); } } ); var gb = new GLatLngBounds( one, two ); map.setCenter( gb.getCenter(), map.getBoundsZoomLevel( gb ) );