[Tilecache] problems getting tilecache.cfg and Openlayers WMS parameters in sync

Christopher Schmidt crschmidt at metacarta.com
Fri Jul 20 08:24:15 EDT 2007


On Fri, Jul 20, 2007 at 01:07:17PM +0100, David Herbert wrote:
> I have Geoserver WMS map layers (a base layer and a
> number of overlays) which I wish Tilecache to cache.  Here are the
> relevant bits of my tilecache.cfg:
> 
> [sggis:bathy_poly,sggis:coast_polygon]
> type=WMSLayer
> url=http://10.48.1.76:8080/geoserver/wms
> layers=sggis:bathy_poly,sggis:coast_polygon
> extension=png
> bbox=-82000,7800,80000,116000
> srs=EPSG:2007056
> 
> var sgStandardLayerOpts = {        
>     'maxExtent' : new OpenLayers.Bounds(-82000,7800,80000,116000), 
>     'maxResolution' : 'auto',
>     'minResolution' : 0.5,
>     'units' : 'm',    
>     'projection' : EPSG:2007056
> };
> 
> to initialise my map to the full extent of the enclosing <div>.  I am
> not fussy about the set of resolutions or zoom levels.  When I bring up
> my map, the following URL is fetched:

"maxResolution:'auto'" will probably not work with TileCache. What this
means is 'calculate the bounding box based on the width of the map div',
which can change every time the page is loaded. It looks like your map
might be about 800 pixels wide (can't tell for sure).

What you should do instead is set an explicit maxResolution on the
layer, in both OpenLayers and TileCache. For your current setup, it 
looks like your current maxResolution should be:

  200.370370

So, your TC config should have this added to it:

maxResolution=200.370370

and your OpenLayers config should have this added to it:e
  
  'maxResolution': 200.370370

(this will replace the maxResolution: 'auto').

After that, TC should work.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Tilecache mailing list