Change map types from outside links
Description
"setMapTypeId()" methods of Map class is used to change the map type. You can set one of maptype of these:
| google.maps.MapTypeId.ROADMAP | This map type displays a normal street map. |
| google.maps.MapTypeId.SATELLITE | This map type displays satellite images. |
| google.maps.MapTypeId.HYBRID | This map type displays a transparent layer of major streets on satellite images. |
| google.maps.MapTypeId.TERRAIN | This map type displays maps with physical features such as terrain and vegetation. |
mapCanvas.setMapTypeId(google.maps.MapTypeId.TERRAIN);
Code
<script type='text/javascript'>
var mapCanvas;
function initialize() {
var latlng = new google.maps.LatLng(40.7711329, -73.9741874);
var myOptions = {
zoom: 4,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
mapCanvas = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}
function changeMapType(mapTypeId) {
mapCanvas.setMapTypeId(google.maps.MapTypeId[mapTypeId]);
}
google.maps.event.addDomListener(window, "load", initialize);
</script>



