除您自己的多边形 google 地图外,禁用企业和其他 POI 的信息窗口
Disable infowindows for businesses and other POIs aside from your own polygons google maps
Google 地图允许兴趣点(例如餐厅和其他东西)显示为可点击,并在点击时显示它们的信息窗口,这不是我想要的。我只需要附加到我的多边形的信息窗口即可单击并弹出打开的信息窗口。我注意到解决此问题的一种方法是更改 google 地图的样式:
[
{
featureType: "poi.business",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
]
但是对于诸如景点和其他随机可点击的东西之类的东西,信息窗口仍然出现,我怎样才能为这些东西禁用信息窗口?或者您可以只使用 featureType: "poi" 和 featureType: "transit" 将可见性设置为关闭以解决此问题吗?
试试这个。这样所有 poi
都被禁用:
[
{
featureType: "poi",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
];
好的,我做了一个可以删除大部分功能的函数:
/**
* 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});
}
Google 地图允许兴趣点(例如餐厅和其他东西)显示为可点击,并在点击时显示它们的信息窗口,这不是我想要的。我只需要附加到我的多边形的信息窗口即可单击并弹出打开的信息窗口。我注意到解决此问题的一种方法是更改 google 地图的样式:
[
{
featureType: "poi.business",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
]
但是对于诸如景点和其他随机可点击的东西之类的东西,信息窗口仍然出现,我怎样才能为这些东西禁用信息窗口?或者您可以只使用 featureType: "poi" 和 featureType: "transit" 将可见性设置为关闭以解决此问题吗?
试试这个。这样所有 poi
都被禁用:
[
{
featureType: "poi",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
];
好的,我做了一个可以删除大部分功能的函数:
/**
* 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});
}