我想在我的网站上嵌入以下 map :
map 上有所需地址的标记,但它也有附近地点的标记,如 Costa 咖啡厅、Eastgate 时钟等。
有没有办法在 map 上嵌入 map 而不标记任何其他地方?
澄清一下,我想保留大红色标记,但删除所有其他名胜古迹
最佳答案
Google Map api 允许开发者控制其外观,引用syntax styling
Map Features: A map consists of a set of features, such as a road or park, which are specified using a MapTypeStyleFeatureType. The feature types form a category tree, with all as the root. The full list of features for selection within a map is documented in the Maps Javascript API V3 Reference. Specifying the feature as all will select all map elements.
google.maps.MapTypeStyleFeatureType
包括许多要素类型的值,即 road.labels、landscape.natural、poi.business
,
在你的情况下,隐藏其他业务地点的方式,这里是一个实现的例子:
var styles = [
{
featureType: "poi",
elementType: "business",
stylers: [
{ visibility: "off" }
]
}
];
map.setOptions({styles: styles});
关于javascript - 在 iframe 中嵌入谷歌地图时,如何删除附近的地点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19957090/