[OpenLayers-Dev] bbox approximations for non-base layers

mario.beccia at tiscali.it mario.beccia at tiscali.it
Tue Jun 26 14:39:42 EDT 2007


Hi all,

this is my first post to the list and I'm still experiencing with 
openlayers, so I hope I'm not posting something irrelevant ;-)

I'm trying to build up a system which is making use of openlayers + 
tilecache + GeoServer.
I'm experiencing a lot of problems with tilecache, which is refusing 
to provide non-base layers correctly when I'm using zoom levels 
different than 1.
The messages I get in the log are about not being able to calculate 
the tile coordinates and/or saying that the tile is out of the layer 
scope.

After a bit of debugging, I discovered that OpenLayers is sending the 
bbox with different approximation levels if the layer is a base layer 
or if it is an overlay.
For the same layer (same zoom level, same conditions, same properties 
in the openlayers creation js, only difference is the "baseLayer" 
flag), OpenLayers is sending the following request if it is a base 
layer (I paste the request for 1 tile in the layer, it happens for 
almost all the tiles...):

192.168.115.1 - - [26/Jun/2007:09:35:41 -0700] "GET 
/tilecache/tilecache.py?LAYERS=basic&FORMAT=image%
2Fpng&SERVICE=WMS&VERSION=1.1.1
&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.
se_inimage&SRS=EPSG%3A4326&BBOX=-90%2C0%2C0%2C90&WIDTH=256&HEIGHT=256 
HTTP/1.1" 200 4813

If I make it a non base layer, the request it generates for the same 
tile is:
192.168.115.1 - - [26/Jun/2007:09:32:21 -0700] "GET 
/tilecache/tilecache.py?LAYERS=basic&FORMAT=image%
2Fpng&SERVICE=WMS&VERSION=1.1.1
&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.
se_inimage&SRS=EPSG%3A4326&BBOX=-90%2C-0.175781%2C0%2C89.
824219&WIDTH=256&HEIGHT=256 HTTP/1.1" 500 727

As you'll notice, the bbox is different in the second request: instead 
of (-90,0,0,90), openlayers sent (-90,-0.175781, 0,89.824219).

Another example for a different tile:
Base layer:
192.168.115.1 - - [26/Jun/2007:09:35:41 -0700] "GET 
/tilecache/tilecache.py?LAYERS=basic&FORMAT=image%
2Fpng&SERVICE=WMS&VERSION=1.1.1
&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.
se_inimage&SRS=EPSG%3A4326&BBOX=-180%2C0%2C-90%
2C90&WIDTH=256&HEIGHT=256 HTTP/1.1" 200 3004

Non base layer:
192.168.115.1 - - [26/Jun/2007:09:32:21 -0700] "GET 
/tilecache/tilecache.py?LAYERS=basic&FORMAT=image%
2Fpng&SERVICE=WMS&VERSION=1.1.1
&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.
se_inimage&SRS=EPSG%3A4326&BBOX=-180%2C-0.175781%2C-90%2C89.
824219&WIDTH=256&HEIGHT=256 HTTP/1.1" 500 727

Thie time the bbox in the first request was (-180,0,-90, 90), whereas 
it becomes (-180, -0.175781,-90, 89.824219) for a non base layer.

Digging in the code, my understanding is that when a tile request for 
a non-base layer must be produced, OpenLayers projects the layer coords 
in the baseLayer srs. Even if the layers share the same srs, the 
calculation is made anyway and an approximation error is produced (I'm 
using a Linux FC5 + FireFox 2.0.0.4, but I don't think there would be a 
huge difference with other os/browser combinations).
While may not be a problem with a normal wms, it becomes so when 
something like tilecache (which is making some additional calculations 
on tile requests) is put in the middle. Tilecache contains a 
"threshold" for float values comparison, but I don't think that 
adjusting it from 0.0001 (default value) to 0.1 (needed to work around 
the approximation errors) would be a good solution (we lose too much in 
terms of precision...).

The solution I'm using is to disable the reprojection on the 
transparent layers (using the reproject flag), and it seems to work 
fine.

Is this correct or am I missing something else?

                                                                                                                    
M.








_______________________________________________________
Naviga e telefona senza limiti con Tiscali     
Scopri le promozioni Tiscali Adsl: navighi e telefoni senza canone Telecom

http://abbonati.tiscali.it/adsl/




More information about the Dev mailing list