更改谷歌地图的颜色

use*_*516 3 google-maps

是否有可能使用新的Google地图javascript API更改地图的颜色,以便在浅蓝色面板下显示类似此地图的内容

Hei*_*ang 11

风格的地图可能正是您要找的,

首先值得一提的是向导(请注意,在#9中,它应该是styles,不是style)

https://mapstyle.withgoogle.com

这些是参考:

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>
Run Code Online (Sandbox Code Playgroud)