admin管理员组文章数量:1290421
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.setMapTypeId("SATELLITE");
or
map.setMapTypeId(SATELLITE);
or
map.setMapTypeId(mapTypeId:Satellite);
What am I doing wrong here? This is the documentation:
.html#Map
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.setMapTypeId("SATELLITE");
or
map.setMapTypeId(SATELLITE);
or
map.setMapTypeId(mapTypeId:Satellite);
What am I doing wrong here? This is the documentation:
http://code.google./apis/maps/documentation/javascript/reference.html#Map
Share Improve this question edited Dec 7, 2013 at 7:29 Kara 6,22616 gold badges53 silver badges58 bronze badges asked May 17, 2011 at 17:11 mheaversmheavers 30.2k62 gold badges200 silver badges326 bronze badges 1- "but I'm getting errors" - what errors? – slandau Commented May 17, 2011 at 17:14
1 Answer
Reset to default 11You 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);
本文标签: javascriptgoogle maps api v3 setMapType issueStack Overflow
版权声明:本文标题:javascript - google maps api v3 setMapType issue - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741496432a2381854.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论