In Openlayers2.11 examples,i change the "google-v3.html" from google api src "

" to
"

" without the
api vesion,it always show "mapdata" messagebox ,please find the attach.

Comments

philpro’s picture

I'm seeing a similar white box with "Map Data" in the center of my map. This spontaneously started happening. My map used to work.

Dale Baldwin’s picture

I have the same issue coming up, I haven't changed a single thing with any of my modules at all either. I'm guessing its something up stream to do with Open Layers or googles API.

gc23’s picture

maybe this can help,

http://openlayers.org/blog/2010/07/10/google-maps-v3-for-openlayers/

Anyone can pin point where in OL we can change this. @work at the moment

Thanks

philpro’s picture

Sounds like openlayers is broke at the moment. Should we wait on a fix from the open layers people or what?

henryblyth’s picture

This has also been noticed on the GIS StackExchange: http://gis.stackexchange.com/questions/20604/google-maps-layer-copyright...

The following CSS can hide the box, but potentially violates Google's Terms (see link above for details):

.olLayerGooglePoweredBy.olLayerGoogleV3.gmnoprint {
visibility:hidden;
}

Not sure what to do regarding production sites. My decision is to wait it out a bit and see how it develops.

jmatuska’s picture

Yes, the white box just started happening for me this morning. Has been working perfectly for over a week. Also the custom CSS for my pop-up is all messed up today. text overlapping text where it too has been wonderful for over a week...

Anonymous’s picture

Me too...

deadlyspot.com’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev

Had to switch production site over to default to Open Layers because of this. I also note that sites I have built before that use the old Google API Key have no problem.

noslokire’s picture

Have switched all map layers on all of our sites to use OSM Mapnik instead of Google.

Love OpenLayers for this flexibility, but would be nice to have the Google maps back without the popup.

zzolo’s picture

Title: google map always show "map data" message box » Find a way that manages versions of Google and OL so that the Google TOS box does not appear.
Category: bug » task
Priority: Critical » Major

As pointed out in #1588528: Google copyright pop-up , this is an issue with OpenLayers library and the ever changing Google Maps API. This is not anything to do directly with this module.
http://trac.osgeo.org/openlayers/ticket/3614

I know this may not be a solution for everyone, but like @noslokire, maybe Google is not the right choice for you. And if it is, the GMap module may be a better place to look for what you need. This is not the first time that this has been an issue, as Google is aggressive on how its API gets used. I am not trying to be mean spirited with this statement, but it is very hard for this module to maintain compatibility with the OL library and other external libraries it may use.

As far as getting around this issue, there isn't too much to do that I can see at the moment. In theory you could use the newest version of the OpenLayers library and since we are already forcing the use of Google Maps API v3.6, this should work. But this may involve getting the OL library directly from the source. And this runs a lot of risk of this module itself breaking as trying to maintain compatibility with the OL library itself and this module is not always easy (hence why we strongly suggest using 2.11 of the OL library).

Also, there may be an option of porting that patch at http://trac.osgeo.org/openlayers/ticket/3614 to be included in your site, but I have not looked at it in detail enough to know how easy that is, especially considering that it is for the context of the OL library itself, but in theory it should work. I would love to see that posted here, but I don't think that's a good option for including in this module.

and finally, I have already tried to play around with this using the OL 2.11 library, but the module already has support for including a couple different version of the Google API under Layers -> API Keys. You can attempt to change some of these to get it to work, but I am not hopeful of this.

I understand this is a serious issue for a lot of people, and my apologies, but please do realize that this is not a direct issue with this module. And I hope to be able to look at this issue soon, but there are not a lot of resources being put towards this module recently, so I cannot promise anything.

semiaddict’s picture

It seems this has been fixed in the dev version of the OpenLayers library.

So if this is critical enough for some of you, you might want to replace your sites/all/libraries/OpenLayers/OpenLayers.js file with the dev release found at http://openlayers.org/dev/OpenLayers.js

But it might be a good idea to wait for the next stable release for production sites.

zzolo’s picture

I did some initial testing with the hosted dev version and ran into some errors. Not enough time to fully debug.

pipicom’s picture

#11 works for me.. Thanks semiaddict..

matthew gibbon’s picture

following

matthew gibbon’s picture

Dev version didnt work for me

pikot’s picture

#11 works for me. As mentioned by semiaddict, i changed the version of the OpenLayers library, in my case in the administration page (/admin/structure/openlayers) in "OpenLayers Source" field (BEFORE: http://openlayers.org/api/2.11/OpenLayers.js, LATER: http://openlayers.org/dev/OpenLayers.js).

matthew gibbon’s picture

url link worked for me

webmestre’s picture

following

henryblyth’s picture

@zzolo, what bugs did you encounter exactly? I'm not asking for a debug as you mentioned you didn't have time for that; just a heads-up of what we could expect.

@matt1 and @webmestre, you can now follow issues without posting a comment by clicking "Follow" at the top of the issue =)

#11 has been working for me. I downloaded http://openlayers.org/dev/OpenLayers.js on 23/05/2012 so that I could host it locally. The Google Maps API version being asked for is still 3.5.

matthew gibbon’s picture

Thanks @henryblyth ... will remeber that

I would like to download the Dev version to run it on my server instead of via the URL, but the url points to one page. How/what do I replace the existing files and folders I have in my library with this dev code?

jefkin’s picture

I went with #11...

@matt1; I too wanted it local. I have OpenLayers 2.11 installed locally in my site's Library directory. I coppied it to a new folder and downloaded the link http://openlayers.org/dev/OpenLayers.js over top of the copied 2.11 version.

From a user experience this solves everything. From an admin experience I get the not so pleasant warning message on just about every admin page for OpenLayers. Like the below or similar to it:

Not suggested compatible version. Though you are very welcome to use whatever version of the OpenLayers library you want, it is suggested that you use version 2.11. You are currently not using that version or we are unable to determine which version you are using. Update your library settings at OpenLayers settings.

At best this should be a temporary work around until OpenLayers gets around to generally updating it's 2.12 to a usable status.

zzolo’s picture

As pointed out by @tuccio in #1602020: Attribution pop-up annoyingly keeps appearing, this might work:

div.olLayerGooglePoweredBy {
   visibility:hidden;  
}
emptyvoid’s picture

My comment for this issue provides a 'Solution'...

http://drupal.org/node/1606840

jamescl’s picture

Anonymous’s picture

After trying a patch to the OL library found on github, I opted for a CSS workaround using a negative z-index.

visibility:hidden hides an element, but still allows it to take up space. Which would mean browsers would let the popup take up space atop your map. This just sounded like an opportunity for buggy behavior so instead I opted to completely change the stack order of the popup div.

.olLayerGooglePoweredBy {z-index:-10 !important;}

Whatever the CSS, hiding the popup could potentially be considered a violation of Google's terms. So I'm hoping eventually the OL library catches up and I can remove the workaround.

pol’s picture

#11 worked for me but I encountered another problem: #1646646: Label class/style problem when using Openlayers Dev version.

riaan burger’s picture

Marked #1678940: Copyright block popup as duplicate of this issue.

ordermind’s picture

#24 seems to be working fine.

eliosh’s picture

Can't use patch as linked in #24.

I include following JS code via hook_init, with a weight of 20, and it goes after the OpenLayer.js, but it doesn't work :-\

Drupal.behaviors.openlayers_patch = {
    'attach': function(context, settings) {
        if (typeof(Drupal.settings.openlayers) === 'object' && Drupal.settings.openlayers.maps ) {
            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);
            };
        }
    }
};


nvaken’s picture

#24 seems to fix the issue for me. I've added the following in openlayers.module on line 124:

drupal_add_js('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);
};','inline');
eliosh’s picture

For a quick solution, there is a patch with idea from Ambidex (#30)

Index: sources/sites-all/modules/contrib/openlayers/openlayers.module
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- openlayers.module	(revision )
+++ openlayers.module	(revision )
@@ -121,6 +121,52 @@
       '/openlayers.css', 'file');
     drupal_add_js(drupal_get_path('module', 'openlayers') . 
       '/js/openlayers.js', 'file');
+
+    drupal_add_js('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);
+};','inline');
   }
 }
 

Alexander_Gurov’s picture

Subscribing

Is there any possibility to add that solution to module soon?

michaellenahan’s picture

Issue tags: +Sandbox module

I've made a small sandbox module containing the javascript code from #30.

Putting it in a separate module means I don't have to hack the openlayers module every time I download the latest dev version.

Here it is: http://drupal.org/sandbox/michaellenahan/1840578.

rogical’s picture

Status: Active » Needs review
StatusFileSize
new345 bytes

Can we just hide the box?

finex’s picture

@rogical: hiding the box is against Google rules.

pol’s picture

Have you tried to upgrade your OL version to 2.12 ?

rogical’s picture

StatusFileSize
new134.18 KB

We just hide the popup, not hiding all the data info, see the bottom of the map, it shows clearly the copyright.
dd

pol’s picture

Status: Needs review » Closed (works as designed)

You have to upgrade OpenLayers to 2.12.

pol’s picture

Issue summary: View changes

change