javascript - 在 iframe 中嵌入谷歌地图时,如何删除附近的地点?

标签 javascript php html css google-maps

我想在我的网站上嵌入以下 map :

https://maps.google.co.uk/maps?q=67+Bridge+Street,+Chester&hl=en&sll=53.16379,-2.737316&sspn=0.678421,2.113495&oq=67+bridge+&hnear=67+Bridge+St,+Chester+CH1+1NW,+United+Kingdom&t=m&z=16

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/

相关文章:

javascript - 在 gist Ace 编辑器中启用 Vim 模式

Javascript/ typescript : How to run code directly after the return statement in the same scope?

php - 水平扩展环境中的 Laravel 数据库 session

php - 从 PHP Facebook 应用程序发送礼物?

javascript - 使用 Mongoose 将在线购物车项目插入 MongoDB

php - 从 jQuery 源数组访问数据?

PHP 不区分大小写的数组搜索函数

php - 如何为 cakephp 中的某些操作禁用安全组件?

CSS : Centering multiple lines of text in a DIV

javascript - 当兄弟存在时,为什么 nextElementSibling 和 nextSibling 为 null?