[Tilecache] a couple of possibly silly renderTile API questions

Christopher Schmidt crschmidt at metacarta.com
Fri Apr 4 14:07:34 EDT 2008


On Fri, Apr 04, 2008 at 07:02:43PM +0200, Fredrik Lundh wrote:
> 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.

I don't have a major problem with that. I'm not really strongly of the
opinion that anything other than TileCache.Service.renderTile is a
stable API, so as long as it didn't break existing custom backends (I
can provide an example if neccesary), I'd be okay with this. 

> - 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?

Nope. It sounds confusing enough I'm not even really sure I understand
it, much less how to implement it :)

One idea: if you can 'pre-cache' everything, just build up tiles (using
the cache's 'set' method) and use TileCache to serve against them? All
that renderTile cares about is "I get the tile back that I asked for"
-- everything else that is done by the backend is 'hidden', so you'd
just turn metaTile off, do it behind the scenes, and not tell any of the
rest of the code.

just a thought.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Tilecache mailing list