[OpenLayers-Users] how-to calculate resolutions for custom tiles

Christopher Schmidt crschmidt at metacarta.com
Tue Dec 9 15:48:15 EST 2008


On Tue, Dec 09, 2008 at 02:33:36PM -0600, Greg Donald wrote:
> On Tue, Dec 9, 2008 at 1:48 PM, Christopher Schmidt
> <crschmidt at metacarta.com> wrote:
> >>     //resolutions: [ 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1 ],
> >>     //resolutions: [ 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5, 0.25 ],
> >>     //resolutions: [ 1, 0.5, 0.25, 0.125, 0.0625, 0.03125, 0.015625,
> >> 0.0078125, 0.00390625, 0.001953125, 0.0009765625 ],
> 
> It does work really well, but something is still not quite right,
> maybe it's other settings.
> 
> > I'd expect this last one to work. You could also simply set
> > "maxResolution": 1, and it would calculate the rest on its own. What
> > aspect of that isn't working for you?
> 
> On the top row, on some resolutions, I get calls for images with
> negative coordinates.  I'm not sure why that's happening since I'm
> using
> 
> maxExtent: new OpenLayers.Bounds( 0, 0, 1667867, 403 )
> 
> and all my bounds are positive.  I can't provide a (0, -1) image since
> non exist.

This may well be a rounding issue in OpenLayers. I'd be happy to take a
look at a website demonstrating this problem: it may well be a problem
in the lib  rather than your app.

> But if I don't set restrictedExtent: to something I get an ugly black
> border around my entire map.

Your tiles probably *have* a black border around them -- 403 doesn't
divide into 256 evenly, so there has to be *some* color in the area
outside the tiles...  

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list