Javascript 谷歌地图 api v3 没有标签?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3110020/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
google maps api v3 no labels?
提问by aeq
Is there a way to turn off all labels (street names, state names, country names etc.) from google maps using the API v3? Or are these built directly into the map images?
有没有办法使用 API v3 从谷歌地图中关闭所有标签(街道名称、州名、国家名称等)?或者这些是直接内置到地图图像中的吗?
回答by Ossama
Yes, you can do this using the Styled Mapsfeature of the Google Maps API v3.
是的,您可以使用Google Maps API v3的样式化地图功能执行此操作。
Specifically, this style will disable all labels:
具体来说,此样式将禁用所有标签:
[
{
featureType: "all",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
]
You can apply it to a current map by using:
您可以使用以下方法将其应用于当前地图:
var customStyled = [];//(array shown above)
map.set('styles',customStyled);
回答by Diogo Alves
Yes, you can change labels visibility property directly in css code using Styled Maps feature
是的,您可以使用样式化地图功能直接在 css 代码中更改标签可见性属性
or directly using the Styled Maps Wizardwebsite
或直接使用样式化地图向导网站

