开发者

google maps api v3 setMapType issue

I'm trying to change the maptype in google maps from roadmap to satellite when a user clicks on a marker, but I'm getting errors. I've tried:

map.se开发者_StackOverflow社区tMapTypeId("SATELLITE");

or

map.setMapTypeId(SATELLITE);

or

map.setMapTypeId(mapTypeId:Satellite);

What am I doing wrong here? This is the documentation:

http://code.google.com/apis/maps/documentation/javascript/reference.html#Map


You want:

google.maps.MapTypeId.SATELLITE

which evaluates to "satellite" - but you're better off using the API version, in case they ever change the string constant. Full call:

map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜