The following map types are available in the Google Maps API:
|
|
MapTypeId.ROADMAP displays the default road map view. This is the default map type.
MapTypeId.SATELLITE displays Google Earth satellite images
MapTypeId.HYBRID displays a mixture of normal and satellite views
MapTypeId.TERRAIN displays a physical map based on terrain information.
You modify the map type in use by the Map by setting its mapTypeId property, either within the constructor via setting its Map options object, or by calling the map's setMapTypeId() method. The mapTypeID property defaults to MapTypeId.ROADMAP.
|
Setting the mapTypeId upon construction:
var myLatlng = new google.maps.LatLng(-34.397, 150.644);
var mapOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
Modifying the mapTypeId dynamically:
map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
Note that you don't actually set the map's map type directly, but instead set its mapTypeId to reference a MapType using an identifier. The Maps Javascript API V3 uses a map type registry, explained below, to manage these references.
|
|