1
votes

I've got a custom tiles overlay setup using Google Maps API v3. But the backend which generates the images for it is not powerfull enough to handle all of the calls when multiple concurrent users are active. So in many way's I've tried to reduce the number of of tiles requested by the map. There's one more optimisation I can't seem to figure out though:

When a user double clicks to zoom, or uses the zoom control, the map retriggers the tiles overlay which requests the new tile images. But if a user triggers the zoom button or double click again before the tiles have even loaded, these are all wasted calls. So what I would like to do is build a delay which waits x seconds before triggering the new tile images.

With the current event listeners (zoom_changed, dbl_click, click) I can't seem to stop google maps from triggering the new image tiles. It looks like by the time the zoom_changed event triggers, the tiles are already being requested. So I'm kind of missing a way to stop the triggering of getTileUrl. I already know how to re-trigger it, I just want to know a way to stop it when a user is using zoom.

Anyone got an idea how to tackle this?

I'm using this implementation as a base: https://developers.google.com/maps/documentation/javascript/examples/maptype-image-overlay

1

1 Answers

1
votes

Someone at Google pointed me to the right direction. And after some research I figured out that:

google.maps.event.addDomListener(map, "zoom_changed", function () {
  map.overlayMapTypes.setAt(0, null);
}

solved my problem.

This allows me to stop the overlay trigger, so I can now retrigger it whenever I want to.