2012-08-02 103 views

回答

9

是的,這樣稱呼它:

var mapType = "TERRAIN"; 
map.setMapTypeId(google.maps.MapTypeId[mapType]); 
+0

太好了!非常感謝! – MrUpsidown 2012-08-02 00:20:04

+0

感謝此 – byron 2012-09-02 01:22:35

+0

感謝此@Mathletics – ngplayground 2013-11-05 09:46:28

-1
//Console output of MapTypeId 
google.maps.MapTypeId 
{ROADMAP: "roadmap", SATELLITE: "satellite", HYBRID: "hybrid", TERRAIN:"terrain"} 
HYBRID:"hybrid" 
ROADMAP:"roadmap" 
SATELLITE:"satellite" 
TERRAIN:"terrain" 


//change mapTypeId 
map.setMapTypeId("terrain"); //example with hybrid 
//or 
map.setMapTypeId(google.maps.MapTypeId.TERRAIN); // same example with hybrid 
//or as you want 
map.setMapTypeId(google.maps.MapTypeId["TERRAIN"]); // same example with hybrid 
+0

這不會**提供了一個答案的原始問題,順便說一句。已經被適當的解決方案回答了。 – MrUpsidown 2018-02-15 08:25:43