隐藏谷歌地图平面图
Posted
技术标签:
【中文标题】隐藏谷歌地图平面图【英文标题】:hiding google map floor plans 【发布时间】:2012-12-17 02:57:01 【问题描述】:当使用 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
任何帮助或指点将不胜感激。
谢谢, 乔恩。
【问题讨论】:
嗨,我真的很喜欢这种情况,有没有办法实现这一点?你能分享这个场景的演示或代码吗?谢谢 【参考方案1】:好的,经过更多的实验,这就是我解决的问题......在第一种样式中将所有颜色设置为灰色(或您希望平面图采用的任何颜色),然后重新着色您想要的所有颜色以下样式。这会导致平面图显示为单个颜色块。
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'
]
];
【讨论】:
【参考方案2】:似乎“全部”选项是唯一会关闭标签的选项:
http://maps.googleapis.com/maps/api/staticmap?center=51.496643,-0.172192&zoom=18&format=png&sensor=false&size=640x480&maptype=roadmap&style=feature:all|element:labels|visibility:off
虽然 poi.attraction 似乎确实关闭了博物馆的名称,但不是平面图
http://maps.googleapis.com/maps/api/staticmap?center=51.496643,-0.172192&zoom=18&format=png&sensor=false&size=640x480&maptype=roadmap&style=feature:poi.attraction|element:labels|visibility:off
【讨论】:
是的,我也有同样的经历...感谢您的检查。以上是关于隐藏谷歌地图平面图的主要内容,如果未能解决你的问题,请参考以下文章