[OSM-dev] NOT-saving empty Mapnik tiles

marqqs at gmx.eu marqqs at gmx.eu
Tue Aug 16 07:07:54 BST 2011

Hello Igor and Oliver,

presently I use this method:
The image is written to "/dev/shm/tile" (RAM), then the file length is retrieved by os.stat(). If this length exceeds 116 bytes, the file is copied to its destination location in the tile tree, otherwise the destination location is deleted (os.unlink()).

Please don't argue. ;-)

Igor's method WOULD BE much faster than Oliver's if this would be C and not Python. To read 256 KiB in a loop seems not to be very fast whereas a more complicated function takes less execution time because it's a library function.

Maybe there is a library function in Python which does (nearly) the same as Igor's loop? E.g. checking 256 MiB it they are all zero, comparing two 256 MiB memory spaces, or something like that? Or one could write this loop in C and import it somehow from Python?

The optimum solution (if there is any) could be to enhance Mapnik that way that it doesn't store "empty" tiles in the first place - if requested so by the caller. There is no need to generate an empty tile if the rendering algorithm already knows that there is not a single object to display within this tile.


More information about the dev mailing list