[Tilecache] An error occurred: couldn't calculate tile index for layer

Brian Pitts bpitts at emory.edu
Fri Mar 2 14:55:27 EST 2007


Hi,
   I'm having trouble using TileCache with mod_python and OpenLayers. 
When connecting OpenLayers directly to a WMS, the data loads fine. When 
using TileCache, I only get pink broken images.

My tilecache.cfg is

[cache]
type=DiskCache
base=/tmp/tilecache

[US_States]
type=WMSLayer
url=http://localhost/cgi-bin/mapserver
extension=png

My OpenLayers test page is

function init(){
       var mapOptions = { maxExtent: new 
OpenLayers.Bounds(-124.7,24.9,-66.9,49.3) };
       var map = new OpenLayers.Map( 'map', mapOptions );
       var usStates1 = new OpenLayers.Layer.WMS( "Direct",
           "http://localhost/cgi-bin/mapserv",
           {layers: "US_States", format: "image/png"} );
       var usStates2 = new OpenLayers.Layer.WMS( "Cached",
           "http://localhost/tilecache/tilecache.py",
           {layers: "US_States", format: "image/png"} );
       map.addLayers([usStates1, usStates2]);
       map.addControl( new OpenLayers.Control.LayerSwitcher() );
       map.zoomToMaxExtent();
       }

I used Wireshark to check the requests made by OpenLayers. It makes 
requests like GET 
/tilecache/tilecache.py?LAYERS=US_States&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-107.825%2C44.5875%2C-105.0125%2C47.4&WIDTH=256&HEIGHT=256 
HTTP/1.1

and receives errors like

An error occurred: couldn't calculate tile index for layer US_States 
from ([-107.825, 44.587499999999999, -105.0125, 47.399999999999999])
 File "/var/www/tilecache/TileCache/Service.py", line 401, in 
modPythonHandler
   host )
 File "/var/www/tilecache/TileCache/Service.py", line 380, in 
dispatchRequest
   tile = WMS(self).parse(params, path_info, host)
 File "/var/www/tilecache/TileCache/Service.py", line 115, in parse
   return self.getMap(param)
 File "/var/www/tilecache/TileCache/Service.py", line 122, in getMap
   raise Exception(

I tried adding bbox=-124.7,24.9,-66.9,49.3 to tilecache.cfg but it made 
no difference.

Any suggestions?

Thanks,
Brian



More information about the Tilecache mailing list