[Tile-serving] Real time tile merging strategy

Kai Krueger kakrueger at gmail.com
Thu Mar 28 19:25:08 UTC 2013


On 03/28/2013 12:41 PM, sly (sylvain letuffe) wrote:
> Hi again,
>
> Is anyone aware of a renderd or tirex option (or other software ?) able to
> real time merge 2 or more (meta-)tiles themself generated by renderd before
> serving it to client ?
I don't think this is currently possible with mod_tile and renderd or 
the standard tirex mapnik backend.

I believe the mapquest tile serving stack supports this feature.

Just the other day, Matt mentioned that the mapquest rendering stack 
does this at the storage backend abstraction level.

This could be possible  with the new storage backend abstraction 
committed to mod_tile / renderd this week, as well.

If you want to do this at serving time, you would create a new (read 
only) storage backend. This backend would then have two (or more) sub 
storage backends, that retrieve the two tiles and then pass up to 
mod_tile the merged tile.

You would only need to implement the two functions "tile_read" and 
"tile_stat" of the storage interface, which if you have a library 
function that can merge two png's should be pretty easy.

As this doesn't store anything, this would be redone on every call of 
the tile.

Alternatively, if storing isn't the issue (because you don't have a 
combinatorial explosion of different layers you want to merge), you 
could also do this at the write side of the storage interface. Probably 
you would only need to implement " metatile_write", which gets the osm 
layer tile passed in from renderd / mapnik and would merge it with the 
static hillshading before actually writing it out to storage.


This idea doesn't work too well for two updating layers, as it would be 
unclear which expiry information to pass on to mod_tile, or how mod_tile 
would call the correct rendering on the individual layers, but for one 
updating and one static layer, this should work reasonably well.

Kai
>
> The use case is this :
> I have a never changing hillshaded/colored + contours background who takes
> ages to generate and a permanently updated osm layer on top of that, much
> faster to generate.
>
> For practical use reasons, I don't want to let the client do the merging of
> PNGs as an overlay and I prefer to send one only tile resulting in the merge
> of png.
> While still avoiding to regenate the contours one.
>
> I had the idea to set a proxy in front of mod_tile requesting the 2 tiles,
> merge them, store them, and send them to the client, but that forces me to
> manage a storing backend.
>




More information about the Tile-serving mailing list