gpt4 book ai didi

javascript - Google Maps JavaScript API - 建筑样式

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:44:19 24 4
gpt4 key购买 nike

这是我遇到的问题:

enter image description here

我显示了样式化的 Google map 。我似乎无法让大学的建筑物像其他建筑物一样没有颜色和抚摸。我在这里查看了文档:https://developers.google.com/maps/documentation/javascript/reference#MapTypeStyleFeatureType

并尝试了所有方法,但均无效。

这是我的风格:

[
{
"featureType":"water",
"elementType":"geometry",
"stylers":[
{
"color":"#193341"
}
]
},
{
"featureType":"landscape",
"elementType":"geometry.fill",
"stylers":[
{
"color":"#2c5a71"
}
]
},
{
"featureType":"landscape",
"elementType":"geometry.stroke",
"stylers":[
{
"color":"#2c5a71"
},
{
"lightness":-50
}
]
},
{
"featureType":"road",
"elementType":"geometry",
"stylers":[
{
"color":"#29768a"
},
{
"lightness":-37
}
]
},
{
"featureType":"poi",
"elementType":"geometry",
"stylers":[
{
"color":"#406d80"
}
]
},
{
"featureType":"transit",
"elementType":"geometry",
"stylers":[
{
"color":"#406d80"
}
]
},
{
"elementType":"labels.text.stroke",
"stylers":[
{
"visibility":"on"
},
{
"color":"#3e606f"
},
{
"weight":2
},
{
"gamma":0.84
}
]
},
{
"elementType":"labels.text.fill",
"stylers":[
{
"color":"#ffffff"
}
]
},
{
"featureType":"administrative",
"elementType":"geometry",
"stylers":[
{
"weight":0.6
},
{
"color":"#1a3541"
}
]
},
{
"featureType":"poi",
"elementType":"labels",
"stylers":[
{
"visibility":"off"
}
]
},
{
"featureType":"poi.park",
"elementType":"geometry",
"stylers":[
{
"color":"#2c5a71"
}
]
},
{
"featureType":"landscape",
"elementType":"geometry",
"stylers":[
{
"hue":"#406d80"
},
{
"gamma":1
},
{
"lightness":1
},
{
"saturation":0
}
]
},
{
"featureType":"poi",
"elementType":"geometry",
"stylers":[
{
"visibility":"off"
}
]
}
]

甚至可以更改这些建筑物的颜色吗?

最佳答案

map 上未设置样式的建筑物都显示室内地图。我认为您想要做的是设计室内地图的样式。

不幸的是,我认为没有办法重新设计室内地图的样式。我能找到的最接近的东西是:

Remove indoor maps from styled Google Maps

建议的解决方案是:

[
{"stylers": [ {"visibility": "off" } ] },
{"featureType": "water","stylers": [{"visibility": "on"} ] },
{"featureType": "poi","stylers": [ {"visibility": "on"} ]},
{"featureType": "transit","stylers": [{ "visibility": "on"}] },
{ "featureType": "landscape","stylers": [ { "visibility": "on" } ] },
{ "featureType": "road", "stylers": [{ "visibility": "on" } ] },
{ "featureType": "administrative", "stylers": [{ "visibility": "on" } ] },
/* followed by your style if you have specific styles
, otherwise remove the last comma */

]

关于javascript - Google Maps JavaScript API - 建筑样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22776406/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com