[OpenLayers-Trac] Re: [OpenLayers] #3430: load monitoring and resize transitions for Layer.GoogleNG

OpenLayers trac-20090302 at openlayers.org
Sun Aug 28 02:38:59 EDT 2011

#3430: load monitoring and resize transitions for Layer.GoogleNG
 Reporter:  ahocevar        |       Owner:  ahocevar    
     Type:  feature         |      Status:  new         
 Priority:  minor           |   Milestone:  2.12 Release
Component:  Layer.GoogleNG  |     Version:  SVN         
 Keywords:                  |       State:  Review      

Comment(by ahocevar):

 Replying to [comment:3 erilem]:
 >  * why don't we need to clone the tile as in {{{Tile.Image}}} here?

 We don't reuse the frame, because we get it from the GMaps API's
 {{{getTile()}}} function. So we only release the tile to stop GMaps from
 managing it.

 >  * why is a {{{setTimeout}}} needed in the {{{clear}}} function?

 This fixes the issue we previously had with the Hybrid layer.
 {{{clear()}}}, which calls the GMaps API's {{{releaseTile()}}} function,
 is called in {{{draw()}}} before the GMaps API's {{{getTile()}}} function
 is called for the new tile. For some reason (maybe because GMaps uses some
 timeouts itself and an IFrame for loading images so loading can be
 aborted), {{{getTile()}}} does not work as expected (does not always load
 both images of the Hybrid layer) when {{{releaseTile()}}} is called
 immediately before. By using a timeout of 0 ms, we only move
 {{{releaseTile()}}} to the next cycle, and things are fine.

 >  * {{{Tile.Image.initImage}}} now includes code to workaround the "image
 placeholder" issue, why don't we need the same kind of workaround here?

 We don't manage the frame content - GMaps does. I decided to not interfer
 with what Google does to the frame too much - mainly to avoid trouble in
 case the implementation of {{{getTile()}}} changes in some way in the
 future. I cannot answer the question why the result is still better than
 with the OSGeo WMS layer. But I think that the GMaps API loads the image
 in a separate IFrame before setting the src on the target tile (similar to
 the steps described  [http://stackoverflow.com/questions/4926215/cancel-
 single-image-request-in-html5-browsers?answertab=active#tab-top here]),
 and in combination with the proper cache headers of the Google tiles
 (otherwise Webkit browsers would reload the image, rendering the benefit
 of the IFrame to allow aborting of loading images useless) this avoids
 most of the image placeholder issue.

Ticket URL: <http://trac.openlayers.org/ticket/3430#comment:4>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer

More information about the Trac mailing list