2012-03-12 111 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将所有内容放在它上面。

虽然这是不可取的,因为它是导致页面加载时间通过屋顶拍摄!