For a current project, we need to know when a Google map is done loading all of its tiles. I found the following question, which was for the same basic problem: register event "loadend" on layer

So now, we're using the code from that answer:

GEvent.addListener(mGoogleHybridLayer.mapObject, "tilesloaded", function() {
 console.log("Tiles loaded");

However, this gives a reference error for GEvent. Are there some extra requirements for using GEvent? Do we need to import it from somewhere?

I can't post code we're using, because there isn't any yet - even in the browser's debug console, GEvent is undefined.

Using Openlayers 2.11.

EDIT: maybe I should restate the question into one that can actually be answered: what are all the requirements for being able to use GEvent?


You can access a Gmap layer with openlayers through mapObject. See that example (and source code), which gives the ability to use gmap style.

You can try to access events through mapObject. Never tested.

By the way, the example I pointed out uses the version 3 of gmaps.

  • 1
    Excellent, thanks for the resources! For the interested, the syntax goes like so: google.maps.event.addListener(myLayer.mapObject,'zoom_changed',function() { /*whatever*/ }); ... assuming your event is 'zoom_changed' and your layer is myLayer
    – R Thiede
    Nov 23 '11 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.