Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 在谷歌地图上显示消息_Google Maps_Openlayers - Fatal编程技术网

Google maps 在谷歌地图上显示消息

Google maps 在谷歌地图上显示消息,google-maps,openlayers,Google Maps,Openlayers,我在我的学术项目中使用谷歌地图,从几周以后,每当我在地图上执行某些操作(如放大、缩小)时,就会在地图上显示一条消息。原因可能是什么?我需要在代码中配置任何东西 您可以在上图中看到该消息,该消息的标题为“地图数据”。我们在项目中使用开放层地图,编码语言为PHP。我在这里读到,一个原因可能是某些元素掩盖了地图数据版权,但我发现在没有提及这一点的情况下,出现了一些关于同一通知的投诉 我发现的最有希望的选项是,如果不能,则在包含OpenLayers.js后应用补丁 <script src="htt

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


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

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

我发现的最有希望的选项是,如果不能,则在包含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>

OpenLayers.Layer.Google.v3.MapElements=function(){
//这是该mapObject中的任何Google图层第一次被删除
//使其可见。mapObject需要知道容器大小。
google.maps.event.trigger(this.mapObject,“resize”);
var div=this.mapObject.getDiv().firstChild;
如果(!div | | div.childNodes.length<3){
this.respositionTimer=window.setTimeout(
OpenLayers.Function.bind(this.MapElements,this),
250
);
返回false;
}
var cache=OpenLayers.Layer.Google.cache[this.map.id];
var container=this.map.viewPortDiv;
//将ToS和branding内容上移到container div
//取决于zIndex的值,该值不可靠
对于(变量i=div.children.length-1;i>=0;--i){
if(div.children[i].style.zIndex==1000001){
var termsOfUse=div.children[i];
容器.附件(使用术语);
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){
子类(子类[i]);
}
}
this.setGMapVisibility(this.visibility);
};

是的,此问题已在最新版本的OpenLayers中解决。