[Tilecache] tile index error for 2 layers in Open Layers
Alain Bellenger
alain_bellenger at hotmail.com
Tue Aug 7 11:56:02 EDT 2007
Hello
I am using Open Layers and Tilecache to display two layers.
The layers have different extents and I think this is my main problem.
My layers in tilecache.cfg are defined as:
[plu]
type=WMSLayer
layers=plu
url=http://hostname/cgi-bin/mapserv.exe?map=plu.map
extension=png
resolutions=7.055551745557612,3.527775872778806,1.763887936389403,0.7055551745557613,0.35277758727788067
srs=EPSG:27582
bbox=791215.261,98199.634,795660.261,105144.629
size=256,256
[ortho]
type=WMSLayer
layers=ortho
url=http://hostname/cgi-bin/mapserv.exe?map=plu.map
extension=png
resolutions=7.055551745557612,3.527775872778806,1.763887936389403,0.7055551745557613,0.35277758727788067
srs=EPSG:27582
bbox=781000,66000,821000,106000
size=256,256
I am using the following javascript code to display my layers:
var options = {
format: 'image/png',
projection: 'EPSG:27582',
units: 'm',
scales: [20000,10000,5000,2000,1000],
maxExtent: new
OpenLayers.Bounds(791215.261,98199.634,795660.261,105144.629),
isBaseLayer: true,
reproject: false,
buffer: 1
};
var params=
{
layers: "plu"
};
// add layer 1
glGlobal.layer = new OpenLayers.Layer.WMS( 'OpenLayers WMS',
'cgi-bin/tilecache.cgi', params, options);
glGlobal.map.addLayer(glGlobal.layer);
var options2 = {
format: 'image/png',
projection: 'EPSG:27582',
units: 'm',
scales: [20000,10000,5000,2000,1000],
maxExtent: new OpenLayers.Bounds(781000,66000,821000,106000),
isBaseLayer: false,
reproject: false,
buffer: 1
};
var params2=
{
layers: "ortho"
};
// add layer2
glGlobal.ortho = new OpenLayers.Layer.WMS( 'OpenLayers WMS',
'cgi-bin/tilecache.cgi', params2, options2);
glGlobal.map.addLayer(glGlobal.ortho);
// zoom
glGlobal.map.zoomToMaxExtent();
The previous code is what I want. When both layers are presents (one
BaseLayer, the other not BaseLayer) there is an error with tilecache.
If I only have one layer as a BaseLayer and the other commented, there is no
problem.
For example, if I have the layer "plu" as BaseLayer and "ortho" as not
BaseLayer, tilecache says for a tile:
An error occurred: couldn't calculate tile index for layer ortho from
([793382.72649599996, 102534.564992, 793563.34862099995,
102715.18711699999])
File "C:\DWebPro\deploy\www\cgi-bin\TileCache\Service.py", line 481, in
cgiHandler
format, image = service.dispatchRequest( params, path_info, req_method,
host )
File "C:\DWebPro\deploy\www\cgi-bin\TileCache\Service.py", line 397, in
dispatchRequest
tile = WMS(self).parse(params, path_info, host)
File "C:\DWebPro\deploy\www\cgi-bin\TileCache\Service.py", line 122, in
parse
return self.getMap(param)
File "C:\DWebPro\deploy\www\cgi-bin\TileCache\Service.py", line 129, in
getMap
raise Exception(
In OpenLayers, I see that the tiles for my layer "ortho" are aligned with
the tiles of my layer "plu". And so tilecache complains. For tilecache, I
suppose tiles for "ortho" are uniques and depend on the "ortho" bounding box
and so if OpenLayers asks for an unknown tile, there is an error. Am I right
?
If I am right, an answer to my problem should be having tiles for my layers
which are not aligned. Does anybody know a mean to have this configuration ?
Thank you
Alain Bellenger
_________________________________________________________________
Gagnez des écrans plats avec Live.com http://www.image-addict.fr/
More information about the Tilecache
mailing list