Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
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
    
good! thanks for providing the full syntax. –  simo Nov 24 '11 at 7:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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