2016-02-12 53 views
1

我想讓谷歌地圖水背景透明,以便它顯示網頁背景。但是,當我關閉水的能見度時,非洲,歐洲和格陵蘭島的部分景觀會被奇怪的多邊形包圍。谷歌地圖上的奇怪的多邊形,當水能見度關閉

這裏是一個工作JS小提琴鏈接的問題。

https://jsfiddle.net/kgo81ec8/1/

下面是相同的代碼來重現問題。

<html> 
<head> 
    <script src="https://maps.googleapis.com/maps/api/js"></script> 
    <style> 
     body{ 
      background-color:black; 
     } 

     #map{ 
      height:100%; 
     } 
    </style> 
</head> 
<body> 
<div id="map"> 

</div> 

<script> 
     testMe = function() { 
      var styles = [{ 
       "elementType": "water", 
       "stylers": [{ 
        "visibility": "off", 
       }] 
      }, { 
       "featureType": "landscape.natural.landcover", 
       "stylers": [{ 
        "visibility": "on" 
       }] 
      }]; 

      var mapOptions = { 
       zoom : 1, 
       center : new google.maps.LatLng(40, -3), 
       styles : styles, 
       zoomControl : true, 
       zoomControlOptions : { 
        style : google.maps.ZoomControlStyle.LARGE, 
        position : google.maps.ControlPosition.TOP_LEFT 
       }, 
      backgroundColor:"blue" 
      }; 
      new google.maps.Map(document.getElementById('map'), mapOptions); 
     } 

     testMe(); 
    </script> 
</body> 
</html> 

下面是輸出的屏幕截圖。

enter image description here

下面就來測試谷歌在線地圖樣式的鏈接。 http://googlemaps.github.io/js-samples/styledmaps/wizard/index.html

任何幫助表示讚賞,我一直在這個簡單的問題上工作了幾個小時。

回答