开发者

Google Map API - displaying night mode without lines or green

开发者 https://www.devze.com 2023-04-11 16:15 出处:网络
I want to use google maps for one application. I wanted to show the map in night mode. (Dark background for the countries.) I do not want to show any labels, lines, green effect. Just plain countries

I want to use google maps for one application. I wanted to show the map in night mode. (Dark background for the countries.) I do not want to show any labels, lines, green effect. Just plain countries in night mode. These are the style settings I use.

var styleSettings = [
        {
            featureType: 'all',
            stylers : [
                {invert_lightness: 'true'},
                {visibility: 'simplified'}
            ]
        },
        {
            featureType: "all",
            elementType: "labels",
            stylers: [{visibility: 'simplified开发者_高级运维'}]
        },
        {
            featureType: "road",
            elementType: "geometry",
            stylers: [{visibility: 'true'}]
        }
        ];

Then I create a Map and assign this options.

map.setOptions ({styles: styleSettings});

I am still getting lines and green spots. How can i avoid those?


Why are you setting visibility to simplified or true when you don't want to display these things? Set visibility to off. Also, you may want to disable the POIs:

[{
    featureType:"poi",
    elementType:"labels",
    stylers:[{
        visibility:"off"
    }]
}]
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号