隐藏谷歌地图平面图

时间:2013-01-02 18:26:13

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

使用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

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

谢谢, 乔恩。

2 个答案:

答案 0 :(得分: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' }
            ]
        }
    ];

答案 1 :(得分:1)

相关问题