2

我在我的学术项目中使用谷歌地图,从几周后,每当我在地图上进行某些操作(如放大、缩小)时,都会在地图上显示一条消息。可能是什么原因?我需要在其中配置任何东西吗?我的代码。在此处输入图像描述

您可以在上图中看到该消息,消息标题为“地图数据”。我们在项目中使用开放图层地图,编码语言是 PHP。

4

1 回答 1

1

我在这里读到,一个原因可能是某些元素掩盖了地图数据的版权,但我发现一些对同一通知的投诉没有提及这一点就弹出了。

我找到的最有希望的选项是一个页面,上面写着解决方案是升级到 2.12,或者如果你不能,则在包含 OpenLayers.js 后应用补丁

<script src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=false"></script>
    <script src="../lib/OpenLayers.js"></script>
    <script>
    OpenLayers.Layer.Google.v3.repositionMapElements = function() {
        // This is the first time any Google layer in this mapObject has been
        // made visible.  The mapObject needs to know the container size.
        google.maps.event.trigger(this.mapObject, "resize");

        var div = this.mapObject.getDiv().firstChild;
        if (!div || div.childNodes.length < 3) {
            this.repositionTimer = window.setTimeout(
                OpenLayers.Function.bind(this.repositionMapElements, this),
                250
            );
            return false;
        }

        var cache = OpenLayers.Layer.Google.cache[this.map.id];
        var container = this.map.viewPortDiv;

        // move the ToS and branding stuff up to the container div
        // depends on value of zIndex, which is not robust
        for (var i=div.children.length-1; i>=0; --i) {
            if (div.children[i].style.zIndex == 1000001) {
                var termsOfUse = div.children[i];
                container.appendChild(termsOfUse);
                termsOfUse.style.zIndex = "1100";
                termsOfUse.style.bottom = "";
                termsOfUse.className = "olLayerGoogleCopyright olLayerGoogleV3";
                termsOfUse.style.display = "";
                cache.termsOfUse = termsOfUse;
            }
            if (div.children[i].style.zIndex == 1000000) {
                var poweredBy = div.children[i];
                container.appendChild(poweredBy);
                poweredBy.style.zIndex = "1100";
                poweredBy.style.bottom = "";
                poweredBy.className = "olLayerGooglePoweredBy olLayerGoogleV3 gmnoprint";
                poweredBy.style.display = "";
                cache.poweredBy = poweredBy;
            }
            if (div.children[i].style.zIndex == 10000002) {
                container.appendChild(div.children[i]);
            }
        }

        this.setGMapVisibility(this.visibility);
    };
    </script>
    <script src="google-v3.js"></script>
于 2012-05-29T14:41:15.863 回答