When setting the google map type:
map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
Can I replace "TERRAIN" by a js variable containing the string "TERRAIN", "SATELLITE", etc?
Yes, call it like this:
var mapType = "TERRAIN";
map.setMapTypeId(google.maps.MapTypeId[mapType]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With