[Tilecache] a couple of possibly silly renderTile API questions

Fredrik Lundh fredrik at pythonware.com
Fri Apr 4 13:02:43 EDT 2008


I'm currently integrating a Python-based rendering backend with
TileCache, via a custom layer implementation, and a few issues came
up.

- Firstly, could the renderTile API perhaps be modified so you can
return *either* a string or a PIL Image memory from the renderer, and
have the upper layers only convert the image to a string when the
string is actually needed?   This would speed things up if you're
using e.g Mapnik or Image (or our backend ;-) with metatiling, and
also simplify other PIL-based layer implementations.

(to check if an object is an image, do hasattr(data, "im"), or if you
want to get fancy, call Image.isImageType(data) -- which currently
does a hasattr check, but may do other things in addition, in the
future)

- My second question is a bit more complex: we're rendering data sets
that cover only a small region of the coordinate space, and we can
improve performance a *lot* by rendering larger chunks and then
cutting them up in the renderer itself. I guess you could describe
this as "intelligent metatiling"; instead of having TileCache ask for
a 5x5 metatile or so, our renderer can determine the "best" set of
tiles to produce based on the bounding box for the data source, where
and how the data is stored, etc.  Any ideas on how to best implement
this?

regards /F



More information about the Tilecache mailing list