[OpenLayers-Trac] Re: [OpenLayers] #3061: Investigate, and if possible implement more efficient tile positioning

OpenLayers trac-20090302 at openlayers.org
Sun Aug 7 05:16:48 EDT 2011


#3061: Investigate, and if possible implement more efficient tile positioning
-------------------------+--------------------------------------------------
  Reporter:  ahocevar    |       Owner:              
      Type:  task        |      Status:  reopened    
  Priority:  minor       |   Milestone:  2.12 Release
 Component:  Layer.Grid  |     Version:  2.10        
Resolution:              |    Keywords:  mobile      
     State:              |  
-------------------------+--------------------------------------------------

Comment(by ahocevar):

 I'm sure there are other approaches to fractional zoom for layers with
 fixed server resolutions, but with this patch, it could work like this:
 1. Change the default for Map.positioningUnits to "%"
 1. In Layer.Grid::moveTo, when the zoom has changed, find the closest
 server resolution for the requested resolution, and calculate the ratio.
 1. Finish moveTo with the closest server resolution, and save the origin
 and the center:
 {{{
 var origin =
 this.map.getViewPortPxFromLonLat(this.bounds.getCenterLonLat());
 var center = this.map.getViewPortPxFromLonLat(this.map.getCenter());
 }}}
 1. Set the following styles on the layer's div:
 {{{
 style.left = (origin.x - center.x + (size.w - size.w * ratio) / 2) + "px";
 style.top = (origin.y - center.y + (size.h - size.h * ratio) / 2) + "px";
 style.width = (parseInt(style.width, 10) * ratio) + "%";
 style.height = (parseInt(style.height, 10) * ratio) + "%";
 }}}

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


More information about the Trac mailing list