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);
精彩评论