[Tilecache] everyblock use of tilecache & openlayers

Graham Carlyle graham.carlyle at maplecroft.com
Thu Jan 24 13:06:04 EST 2008


Can't use you PIL for this? I'm no expert but seems to produce ok
results...

--
import Image

whole_map = Image.open("world.png")
tile = whole_map.copy()
tile = whole_map.crop((0, 0, 256, 256))
intermediary_whole_map = whole_map.convert("RGB")
reduced_map = intermediary_whole_map.convert("P",
                                             dither=Image.NONE,
                                             palette=Image.ADAPTIVE)
intermediary_tile = tile.convert("RGB")
quantized_tile = intermediary_tile.quantize(palette=reduced_map)
reduced_tile = quantized_tile.convert("P")
reduced_map.save("reduced_map.png", optimize=True)
reduced_tile.save("reduced_tile.png", optimise=True)
--

On Thu, 2008-01-24 at 10:57 -0500, Christopher Schmidt wrote:
> On Thu, Jan 24, 2008 at 02:53:09PM +0000, Graham Carlyle wrote:
> > interesting to note that Adrian Holovaty's new site EveryBlock uses
> > OpenLayers & tilecache.
> > 
> > http://nyc.everyblock.com/streets/brooklyn/kent-ave/473-493/map/
> > 
> > wonder why they haven't used the multiple subdomains speedup trick to
> > serve the images.
> > 
> > the images seem quite big as well for the amount of detail they contain,
> > wonder if they used mapnik or mapserver to generate them.
> 
> They're Mapnik. Mapnik images should be post-processed -- a downsampling
> after the initial load would be extremely helpful to anyone using the
> images. I'm also still pondering whether we can hook in a generic
> 'post-process' hook for tiles -- the problem I'm having thus far is the
> total inability to write anything to downsample them nicely in Python.
> Imagemagick does great, and keeps the same general palette, but
> everything else murders the tiles because it doesn't take into account
> the pallette of the whole map. I did hack in, at one point, this
> functionality, which then wrote the file out to disk, converted it using
> imagemagick, then read it back in, but it felt so wrong I deleted the
> code and haven't looked back :) I have played with downsampling the
> tiles once htey're on disk -- with Mapnik, this has been very effective,
> shrinking tile sizes by up to 70%.
> 
> Regards,




More information about the Tilecache mailing list