6

当使用 Google Map API v3 并使用样式化的地图类型时,我无法隐藏放大时出现的平面图。有许多“MapTypeStyleFeatureType”选项,这些选项都不能帮助隐藏平面图。

https://developers.google.com/maps/documentation/javascript/reference#MapTypeStyleFeatureType

API v3 文档似乎没有包含有关平面图的任何内容。为了清楚起见,这是一个平面图的示例:

http://maps.googleapis.com/maps/api/staticmap?center=51.496643,-0.172192&zoom=18&format=png&sensor=false&size=640x480&maptype=roadmap&style=feature:administrative|visibility:off

任何帮助或指示将不胜感激。

谢谢,乔恩。

4

2 回答 2

3

好的,经过更多的实验,这就是我解决的问题....在第一种样式中将所有颜色设置为灰色(或您希望平面图采用的任何颜色),然后在以下样式中重新着色您想要的所有颜色。这导致平面图显示为单个颜色块。

var styles = [
        {
            featureType: "all",
            stylers: [
                { color: "#505050" }
            ]
        },
        {
            featureType: "road",
            elementType: "geometry",
            stylers: [
                { visibility: "simplified" },
                { color: '#505050' }
            ]
        },
        {
            featureType: "all",
            elementType: "labels",
            stylers: [
                { visibility: "off" }
            ]
        },
        {
            featureType: "administrative",
            stylers: [
                { visibility: "off" }
            ]
        },
        {
            featureType: "transit",
            stylers: [
                { visibility: "off" }
            ]
        },
        {
            featureType: "poi",
            stylers: [
                { visibility: "off" }
            ]
        },
        {
            featureType: "landscape",
            stylers: [
                { color: '#FF0000' }
            ]
        },
        {
            featureType: "landscape.man_made",
            stylers: [
                { color: '#393939' }
            ]
        },
        {
            featureType: "landscape.natural",
            stylers: [
                { color: '#393939' }
            ]
        },
        {
            featureType: "water",
            stylers: [
                { color: '#252525' }
            ]
        }
    ];
于 2013-01-03T12:13:38.757 回答