如何制作黑色和谷歌地图白色

时间:2013-02-14 15:07:54

标签: google-maps google-maps-api-3

我试图制作黑白的谷歌地图,但我找不到办法。但是我发现这个网站实现了它:http://www.creuna.com/contact/find-us/

有任何线索吗?

2 个答案:

答案 0 :(得分:5)

我之前没有使用它,但看起来Google的地图API有一个样式部分,可让您真正自定义地图的外观和感觉:

https://developers.google.com/maps/documentation/javascript/styling

有很多例子可以提供帮助。

答案 1 :(得分:1)

查看Styled Map Wizard 这很接近:

 [ { 
  "featureType": "water", 
  "stylers": [ { 
    "color": "#ffffff" } 
    ] 
  },{ 
  "featureType": "landscape", 
  "elementType": "geometry", 
  "stylers": [ { 
    "color": "#000000" } 
   ] 
  },{ 
  "featureType": "administrative", 
  "elementType": "labels.text.fill", 
  "stylers": [ { 
    "color": "#ffffff" } 
    ] 
  },{ 
  "featureType": "administrative", 
  "elementType": "labels.text.stroke", 
  "stylers": [ { 
    "visibility": "simplified" } 
    ] 
  },{ 
  "featureType": "road", 
  "elementType": "geometry", 
  "stylers": [ { 
    "visibility": "off" } 
    ] 
  },{ 
  "featureType": "poi", 
  "elementType": "geometry.fill", 
  "stylers": [ { 
    "color": "#000000" }, { 
    "visibility": "simplified" } 
    ] 
  },{ 
  "featureType": "administrative.province", 
  "stylers": [ { 
    "visibility": "off" } 
    ] 
  },{ 
  "featureType": "road", 
  "elementType": "geometry.stroke", 
  "stylers": [ { 
    "color": "#ffffff" }, { 
    "weight": 2 }, { 
    "visibility": "off" } 
    ] 
  },{ 
  "featureType": "administrative.locality", 
  "stylers": [ { "visibility": "off" } 
    ] 
  },{ 
  "featureType": "road", 
  "elementType": "labels", 
  "stylers": [ { 
    "visibility": "off" } 
    ] 
  },{ 
  "featureType": "poi", 
  "stylers": [ { 
    "visibility": "off" } 
    ] 
  },{ 
  "featureType": "transit", 
  "stylers": [ { 
    "visibility": "off" } 
    ] 
  },{ 
  "featureType": "administrative.neighborhood", 
  "stylers": [ { 
    "visibility": "off" } 
    ] 
  } 
]

Working Example/proof of concept (using above style)从文档中的this exmaple开始,显然需要进行一些调整。仅供参考 - 您链接的示例是来自Stamen Maps的自定义地图类型。