[Tilecache] Problem moving tilecache from Ubuntu 12.04 to 14.04

Stephen Woodbridge woodbri at swoodbridge.com
Thu Jul 9 10:43:29 PDT 2015


So here is an example of how I converted it:


tilecache.cfg
------------------

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

[land]
type=MapServerLayer
mapfile=/maps/wms/land.map
layers=land
extension=png
bbox=-131.00, 12.00, -66.00, 49.00
maxResolution=0.10
srs=EPSG:4326
levels=15
extent_type=loose
debug=true

mapcache.xml
------------------
<?xml version="1.0" encoding="UTF-8"?>
<mapcache>
   <metadata>
     <title>WMS Tile Server</title>
     <abstract>...</abstract>
   </metadata>

   <cache name="disk" type="disk">
     <base>/data/mapcache</base>
     <symlink_blank/>
   </cache>

   <source name="land" type="wms">
     <getmap>
       <params>
         <FORMAT>image/png</FORMAT>
         <MAP_IMAGETYPE>png</MAP_IMAGETYPE>
         <LAYERS>land</LAYERS>
         <MAP>/maps/wms/land.map</MAP>
       </params>
     </getmap>
     <http>
       <url>http://localhost/cgi-bin/mapserv</url>
     </http>
   </source>

   <format name="PNGQ_FAST" type="PNG">
     <compression>fast</compression>
     <colors>256</colors>
   </format>

<grid name="WGS84_ALT">
    <metadata>
       <title>GoogleCRS84Quad</title>
 
<WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GoogleCRS84Quad</WellKnownScaleSet>
    </metadata>
    <extent>-131.00 12.00 -66.00 49.00</extent>
    <srs>EPSG:4326</srs>
    <units>dd</units>
    <size>256 256</size>
    <resolutions>0.10 0.05 0.025 0.0125 0.00625 0.003125 0.0015625 
0.00078125 0.000390625 0.0001953125 0.00009765625 0.000048828125 
0.0000244140625 0.00001220703125 0.000006103515625</resolutions>
</grid>

   <tileset name="land">
     <source>land</source>
     <cache>disk</cache>
     <grid>WGS84_ALT</grid>
     <format>PNGQ_FAST</format>
     <metatile>5 5</metatile>
     <!-- metabuffer must be the abs() of what is in the mapfile -->
     <metabuffer>20</metabuffer>
     <expires>3600</expires>
   </tileset>

   <default_format>PNGQ_FAST</default_format>

   <service type="wms" enabled="true">
     <full_wms>assemble</full_wms>
     <resample_mode>bilinear</resample_mode>
     <format>PNGQ_FAST</format>
     <maxsize>4096</maxsize>
   </service>
   <service type="tms" enabled="true"/>

   <errors>report</errors>
   <lock_dir>/tmp</lock_dir>

</mapcache>


/etc/apache2/mods-enabled/mapcache.conf
---------------------------------------

<IfModule mapcache_module>
     <Directory /data/mapcache>
        Require all granted
     </Directory>
     MapCacheAlias /mapcache "/data/mapcache/mapcache.xml"
</IfModule>


Disk structure
-----------------------------
# ls -Rl /data/mapcache/
/data/mapcache/:
total 36

drwxr-xr-x 2 root root 4096 Jul  8 14:40 land
-rw-r--r-- 1 root root 6026 Jul  8 14:36 mapcache.xml

/data/mapcache/land:
total 0
lrwxrwxrwx 1 root root 20 Jul  8 14:40 WGS84_ALT -> /data/tilecache/land


And URLs for tiles look like:
http://example.com/mapcache?LAYERS=land&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

And that is all there is. Probably the tricky part is setting up the 
mapcache.xml grid to match the grid you are using in tilecache.cfg, but 
all in all, it should be pretty straight forward if you read the docs.

I've been using mapcache and its predecessor  for years. It is awesome 
and very fast. See also: http://mapserver.org/mapcache/index.html

-Steve

On 7/9/2015 12:48 PM, Gery . wrote:
>
> That's pretty cool Steve, it would be neat to know more about your
> progress with mapcache.
>
> Gery
>
>  > To: tilecache at lists.osgeo.org
>  > From: woodbri at swoodbridge.com
>  > Date: Thu, 9 Jul 2015 11:31:53 -0400
>  > Subject: Re: [Tilecache] Problem moving tilecache from Ubuntu 12.04
> to 14.04
>  >
>  > After two days of trying to fix this problem and not making any headway,
>  > I gave up and converted the project over to mapcache which was pretty
>  > easy and straight forward. The whole conversion took about 1 hr to
>  > create the mapcache.xml file equivalent to the tilecache.cfg and to edit
>  > the html to point to mapcache and enable it in apache. This used the
>  > existing cache so I didn't need to repopulate it.
>  >
>  > -Steve
>  >
>  > On 7/7/2015 3:21 PM, Stephen Woodbridge wrote:
>  > > 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
>  > > _______________________________________________
>  > > Tilecache mailing list
>  > > Tilecache at lists.osgeo.org
>  > > http://lists.osgeo.org/mailman/listinfo/tilecache
>  >
>  > _______________________________________________
>  > Tilecache mailing list
>  > Tilecache at lists.osgeo.org
>  > http://lists.osgeo.org/mailman/listinfo/tilecache



More information about the Tilecache mailing list