[Tilecache] Problem moving tilecache from Ubuntu 12.04 to 14.04

Stephen Woodbridge woodbri at swoodbridge.com
Tue Jul 7 12:21:18 PDT 2015


Hi All,

I'm having a problem upgrading a system with tilecache installed on it. 
After two days and no headway, I probably am missing some basic or I've 
hit a real problem.

The Problem:

On the 14.04 server:

http://74.208.113.181/tilecache-2.01/tilecache.py?LAYERS=bathy_contours&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=-73.4,29.6,-71.8,31.2&WIDTH=256&HEIGHT=256

Errors out with:
An error occurred: Current x value -73.400000 is too far from tile 
corner x -75.000000

but with the same url on the 12.04 server I get an image:

http://74.208.78.238/tilecache-2.01/tilecache.py?LAYERS=bathy_contours&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=-73.4,29.6,-71.8,31.2&WIDTH=256&HEIGHT=256

some tiles are returned correctly and some are not. Here is one that works:

http://74.208.113.181/tilecache-2.01/tilecache.py?LAYERS=bathy_model&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=-76.6,36,-75,37.6&WIDTH=256&HEIGHT=256

http://74.208.78.238/tilecache-2.01/tilecache.py?LAYERS=bathy_model&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=-76.6,36,-75,37.6&WIDTH=256&HEIGHT=256

Situation:

Ubuntu 12.04 LTS server running:
tilecache/precise uptodate 2.11-2
apache2/precise-security 2.2.22-1ubuntu1.8
python/precise-updates uptodate 2.7.3-0ubuntu2.2

and in the apache sites-enabled:
         Alias /tilecache-2.01 /var/lib/python-support/python2.7/
         <Directory /var/lib/python-support/python2.7/>
                 SetHandler python-program
                 PythonHandler TileCache.Service
                 PythonOption TileCacheConfig /etc/tilecache.cfg
         </Directory>


I setup a new server and rsync the tilecache, the /etc/tilecache.cfg and 
set it up using:
tilecache:all/trusty 2.11-2 uptodate
apache2:amd64/trusty-security 2.4.7-1ubuntu4.4 uptodate
python:amd64/trusty 2.7.5-5ubuntu3 uptodate
python2.7:amd64/trusty-security 2.7.6-8ubuntu0.2 uptodate
python3:amd64/trusty 3.4.0-0ubuntu2 uptodate
python3.4:amd64/trusty-security 3.4.0-2ubuntu1.1 uptodate

# python --version
Python 2.7.6

and in the apache sites-enabled:
         Alias /tilecache-2.01 /var/lib/python-support/python2.7/
         <Directory /var/lib/python-support/python2.7/>
                 #SetHandler python-program
                 AddHandler python-program .py
                 PythonHandler TileCache.Service
                 PythonOption TileCacheConfig /etc/tilecache.cfg
                 Require all granted
         </Directory>

The cache should be fully populated so there should be not need to hit 
mapserver but I occasionally get mapserver processes running at 100% for 
long periods of time, probably because the cache thinks it needs to 
generate a metatile. I probably will need to check mapfiles because the 
old server is running MapServer version 6.2.1 and the new server is on 
MapServer version 6.4.1

Problem Analysis:

This is probably faulty or incomplete as it has not lead me to a solution.

1. tilecache is configured and running
2. different versions of apache 2.2 vs 2.4
    - had to make changes in handler above
    - are there other changes like environment variables or initialization
3. system has both python 2.7 and 3.0 installed is something strange 
happening because of this?
4. are the differences in mod_python between the two systems that might 
cause this?
5. there appears to be a pattern to what tiles are ok or broken but its 
not clear what it means. Maybe some kind of rounding issue?
6. I diff'd the files in /var/lib/python-support/python2.7/ tree and 
they are all the same except a few of the pyc files. I recompiled them 
on the new system just be be sure with python -m py_compile 
/path/to/file.py but that did not change anything.

I looked at the Layer.py code and it is failing in getCell() at:

         if exact:
             if (abs(minx - tilex)  / res > 1):
                 raise TileCacheException("Current x value %f is too far 
from tile corner x %f" % (minx, tilex))

because abs(minx - tilex) / res = 256 which seems curious as this is the 
size of a tile. So I'm thinking that this code might be behaving badly:

     def getResolution (self, (minx, miny, maxx, maxy)):
         """
         >>> l = Layer("name")
         >>> l.getResolution((-180,-90,0,90))
         0.703125
         """
         return max( float(maxx - minx) / self.size[0],
                     float(maxy - miny) / self.size[1] )

I'm getting res=0.00625 for the broken request.

So the bottom line, I'm totally lost in this issue and probably looking 
in all the wrong places.

-Steve


More information about the Tilecache mailing list