[OpenLayers-Users] 2.3RC1 - Layer (derived from grid) - Resolution array being reset to default

Christopher Schmidt crschmidt at metacarta.com
Fri Jan 19 13:53:06 EST 2007


On Fri, Jan 19, 2007 at 06:18:51PM +0000, gopal krishnan wrote:
> Hi,
> 
> I have a layer taht implements Grid class. With 2.1 it used to work fine.
> With 2.3 RC1, it no longer uses the resolution array set inside the layer.
> And resolution array gets reset. I understand that some new methods have
> been added and initresolutions() method moved.
> 
> Has the way to set resolution array changed? if so what is the new way to do
> so?

The resolutions should be passed in as an option to the layer. You can
mimic this behavior by changing the line which reads: 

> this.resolutions = [4096,2048,1024,512,256,128,64,32,16,8,4,2,1,0.5,0.25];

To read instead:

options.resolutions = [4096,2048... ];

This will put the resolutions into the options array, which is the
primary source of resolution  data. (In the case where resolutions are
*not* in the options array, the Layer will fall back to the *map*
resolutions -- so you could set them on either.)

The 'right' solution here might be to subclass Layer.initResolutions:
that's what Google, Yahoo, etc. do. But I think that following the above
advice will probably get you up and running with the least change. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list