【问题标题】:GMaps API - remove default POIGMaps API - 删除默认 POI
【发布时间】:2014-06-16 21:29:28
【问题描述】:

如何通过始终呈现的 API 从谷歌地图中删除兴趣点?我的意思是这些点: http://j.mp/1ktcaeB

我已经在几个网站上看到它被删除了,但我找不到如何去做。

感谢您的建议。

【问题讨论】:

标签: api google-maps maps point-of-interest


【解决方案1】:

这应该可以解决问题:

    var myStyles =[
    {
        featureType: "poi",
        elementType: "labels",
        stylers: [
              { visibility: "off" }
        ]
    }
];

不要忘记将styles: myStyles 也添加到var myOptions = {...}

也看看Styled Maps docs

【讨论】:

    【解决方案2】:

    你需要像这样初始化地图:

    map = new google.maps.Map(document.getElementById('map'), {
        zoom: 6,
        center: {lat: 51, lng: 10},
        styles: [    
            {
                featureType: "poi",
                elementType: "labels",
                stylers: [{ visibility: "off" }]
            }
        ]
    });
    

    【讨论】:

      【解决方案3】:

      以防万一您使用 TypeScript,您需要像这样转换 MapTypeStyle 数组:

      const noPoiStyle = <google.maps.MapTypeStyle[]> [
        {
          featureType: "poi",
          elementType: "labels",
          stylers: [
            { visibility: "off" }
          ]
        }
      ];
      

      【讨论】:

        猜你喜欢
        • 2018-11-01
        • 1970-01-01
        • 2012-06-18
        • 1970-01-01
        • 1970-01-01
        • 2021-10-09
        • 1970-01-01
        • 1970-01-01
        • 2019-05-20
        相关资源
        最近更新 更多