谷歌地图风格 - 不能产生显示建筑物的黑暗风格

时间:2017-05-03 17:51:12

标签: google-maps styles

mapstyle.withgoogle.com我可以选择几个主题。标准显示建筑结构恰好符合我的目的。我可以改变颜色,一切正常。但我需要它黑暗。

如果我选择一个黑暗的主题,无论我做什么,都没有可见的建筑结构。 (它显示了一些几何图形,但没有标准主题那么多)。我尝试了各种功能和设置。 (为什么?)

所以,回到标准主题,让它变暗也有其局限性。无论我尝试什么,乡村地区都不会变黑。

您似乎必须从一个基本主题开始,该基本主题附带一组无法更改的预定义参数。但是,当我检查生成的JSON时,没有提到它。所以我想我一定是错的。

然后我尝试将此标准主题与黑暗主题手动合并,但结果并不令人满意。这很有趣,因为我"合并"用空数组[]

基本上我想要一张看起来像this的地图。 (好吧,那个&#34;时髦的地图&#34;,我希望我不必转换到另一个地图提供商等等。顺便说一句,我正在开发android。)< / p>

这是我的style.json(看起来像没有建筑物的废物):

[
  {
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#212121"
      }
    ]
  },
  {
    "elementType": "labels",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "elementType": "labels.icon",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "administrative",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#002eea"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "administrative.land_parcel",
    "stylers": [
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "administrative.neighborhood",
    "stylers": [
      {
        "color": "#002eea"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "administrative.neighborhood",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#002eea"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "landscape.man_made",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#002eea"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "landscape.man_made",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "poi.park",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#181818"
      }
    ]
  },
  {
    "featureType": "road",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "road.arterial",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "road.highway",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "road.highway.controlled_access",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "road.local",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "water",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      }
    ]
  }
]

请有人告诉我,我只是累了,明天应该从头开始尝试,有选择地测试我风格的每一个条目。

2 个答案:

答案 0 :(得分:0)

可能是你在寻找

landscape.man_made

[
  {
    "featureType": "landscape.man_made",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "color": "#004040"
      }
    ]
  }
]

答案 1 :(得分:0)

一旦您从原始主题中编辑了主题,便无法获取地图来渲染建筑物/结构。

相关问题