从Google地图中删除报告地图错误

use*_*016 10 google-maps

我有一个v3的谷歌地图,并在地图的右下角,有一个"报告地图上的错误"链接叠加到地图上.有谁知道是否可以从地图中删除它?

编辑:这是我的意思的一个例子:http://jsfiddle.net/ahfA5/

小智 12

您可以设置地图样式以摆脱这种情况.查看https://developers.google.com/maps/documentation/javascript/styling#creating_a_styledmaptype

请注意,如果比较前两个屏幕截图,则"报告地图错误"链接会出现在第一个屏幕中,但不会出现在第二个屏幕截图中.

将虚拟样式应用于地图以使其仍然看起来像谷歌地图但没有错误链接的最简单方法是执行以下操作:

var styleOptions = {
        name: "Dummy Style"
    };

 var MAP_STYLE = [
    {
        featureType: "road",
        elementType: "all",
        stylers: [
            { visibility: "on" }
        ]
    }
];
    var mapType = new google.maps.StyledMapType(MAP_STYLE, styleOptions);
    map.mapTypes.set("Dummy Style", mapType);
    map.setMapTypeId("Dummy Style");
Run Code Online (Sandbox Code Playgroud)

这是更新的jsFiddle http://jsfiddle.net/LwNyy/1/

  • 我不理解downvote.这实际上是有效的,它符合谷歌的TOS.不是上面悲观的非答案的粉丝. (2认同)

小智 5

自定义样式地图的一个问题是,当从地图/卫星或街景视图切换回来时,它不会返回到自定义样式实例。

// remove the wrapping container
.gm-style-cc:last-child {
    display: none !important;
}
// remove the link only
a[title="Report errors in the road map or imagery to Google"] {
    display: none !important;
}
Run Code Online (Sandbox Code Playgroud)


tim*_*tim 0

你不能这样做——谷歌试图通过众包提供准确的数据,有时会导致这种情况。忍受它并接受这个限制。如果您将自定义元素绝对或固定放置,则可以将其放置在画布顶部。但这违反了他们的服务条款,因为它还涵盖了版权声明。