KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using the new Google Maps v3 STYLED MAP. I want to change how the map is Styled based on the zoom level. I have the following pseudo-code, how do change my map-style based on the zoom level? var myOptions = { zoom: zoom, center: latlng, disableDefaultUI: true, navigationControl: true, scrollwheel: false, navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL,position: google.maps.ControlPosition.TOP_RIGHT}, mapTypeId: google.maps.MapTypeId.ROADMAP }; var mapStyleZoomedOut = [{ featureType: "landscape", elementType: "all", stylers: [{ visibility: "off" }] }]; var mapStyleZoomedIn = [{ featureType: "landscape", elementType: "all", stylers: [{ visibility: "off" }] },{ featureType: "poi", elementType: "all", stylers: [{ visibility: "off" }] }]; map = new google.maps.Map(document.getElementById("find-map"), myOptions); var styledMapOptions = {map: map}; var styleMapType = new google.maps.StyledMapType(mapStyle, mapStyleZoomedOut); map.mapTypes.set('minimial', styleMapType); map.setMapTypeId('minimial'); google.maps.event.addListener(map, 'zoom_changed', function() { // === IF Zoom Level <= 8 use mapStyleZoomedIn // === If Zoom Level > 8 use mapStyleZoomedOut }); Thanks in advance
Tags (comma-separated)
Save Edits
Cancel