mheavers
mheavers

Reputation: 30158

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.setMapTypeId("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

Upvotes: 3

Views: 5536

Answers (1)

nrabinowitz
nrabinowitz

Reputation: 55678

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);

Upvotes: 11

Related Questions