2012-03-12 68 views

回答

10

風格的地圖可能是你在找什麼,

值得一首提向導(注意,#9,它應該是styles,不style

http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html

這些都是引用:

http://code.google.com/apis/maps/documentation/javascript/reference.html#StyledMapType

http://code.google.com/apis/maps/documentation/javascript/styling.html

有靜態API http://code.google.com/apis/maps/documentation/staticmaps/#StyledMaps

的飽和度和亮度控制一下在樣式化地圖的例子。飽和度較低=顏色較少,亮度較高=較白

<!DOCTYPE html> 
<html> 
    <head> 
    <style type="text/css"> 
     html, body, #map_canvas { margin: 0; padding: 0; height: 100% } 
    </style> 
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> 
    <script type="text/javascript"> 
     var map; 
     var grayStyles = [ 
     { 
      featureType: "all", 
      stylers: [ 
      { saturation: -90 }, 
      { lightness: 50 } 
      ] 
     }, 
     ]; 
     var mapOptions = { 
     center: new google.maps.LatLng(41.325663, 19.8029607), 
     zoom: 15, 
     styles: grayStyles, 
     mapTypeId: google.maps.MapTypeId.ROADMAP 
     }; 

     function initialize() { 
     map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); 
     } 

     google.maps.event.addDomListener(window, 'load', initialize); 
    </script> 
    </head> 
    <body> 
    <div id="map_canvas"></div> 
    </body> 
</html> 
+0

非常感謝! – user1125516 2012-03-12 17:40:32

+0

@ user1125516如果你喜歡答案,你應該'接受'它。單擊投票按鈕下面的空白滴答作爲答案。 – barryhunter 2012-03-13 23:17:50

0

做這將是嵌入地圖的一種方式,然後用半透明圖像覆蓋它。它不會將顏色更改爲灰度,但您可以將其淡化很多。然後用更高的z-index將所有內容放在它上面。

雖然這是不可取的,因爲它是導致頁面加載時間通過屋頂拍攝!