谷歌地图允许诸如餐馆和东西之类的兴趣点可以点击,并在点击时显示他们的信息窗口,这不是我想要的。我只需要连接到我的多边形的信息窗口可以点击并弹出打开的信息窗口。我注意到一种解决方法是改变谷歌地图的风格:
[
{
featureType: "poi.business",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
]
但是infowindows仍然出现在诸如景点和其他随机可点击的东西之类的东西上,我怎么能够禁用这些东西的infowindows呢?或者你可以使用featureType:" poi"和featureType:" transit"将可见性设置为off以解决此问题?
答案 0 :(得分:1)
试试这个。这样就禁用了所有poi
:
[
{
featureType: "poi",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
];
答案 1 :(得分:1)
好的我做了一个可以删除大部分功能的功能:
/**
* Remove all other unnecessary infowindows by rendering Points of Interest invisible
* Takes the map, applicable for Google Maps API
**/
function suppressUnnecessayInfoWindows(mapUsed) {
// removes POIs and Transit features off the map
var noFeatures = [
{
featureType: "poi",
stylers: [
{ visibility: "off" }
]
},
{
featureType: "transit",
stylers: [
{ visibility: "off" }
]
}
];
// changes the style of the map so that the above is no longer visible
mapUsed.setOptions({styles: noFeatures});
}