Latest web development tutorials

Maps API setMapTypeId () method

Map () constructor Map () constructor

Examples

Change the type of map to display:

map.setMapTypeId(google.maps.MapTypeId.TERRAIN);

try it"

Definition and Usage

setMapTypeId () method is used to change the map type to be displayed.


grammar

mapvariable.setMapTypeId(google.maps.MapTypeId.CONSTANT);


MapTypeId constants

常量 描述
HYBRID 显示一种带公路和城市名称的照相地图。
ROADMAP 显示一种标准的,默认是 2D 的地图。
SATELLITE 显示一种照相地图。
TERRAIN 显示一种带有山脉、河流等的地图。


Map () constructor Map () constructor