[Tilecache] Getting multiple tiles jumbled up for mapnik layer

Sanjiv Singh singhsanjivk at gmail.com
Sun Aug 24 03:37:01 EDT 2008


I was getting it fundamentally wrong. As pointed out by Chris
OpenLayers.Layer.TileCahe is to be used only to requests tiles cached
by TileCache in a web accessible cache.  This means I should have to
pre-populate my cache before using this layer. Using
OpenLayers.Layer.TMS solves the problem.

Also, as the wsgiHandler expects URL as
/1.0.0/global_mosaic/0/0/0.jpg, I had to modify my controler to

    @expose()
    def tiles(self, *args, **kw):
        pylons.request.environ['PATH_INFO'] = '/'.join(args)
        return wsgiHandler(pylons.request.environ,
                        self.start_response, myService)

Regards
Sanjiv

On Thu, Jul 24, 2008 at 1:23 AM, Sanjiv Singh <singhsanjivk at gmail.com> wrote:
> Hi all,
>
> I am trying to serve OpenStreetMap data using mapnik and tilecache. I
> am using tilecache in a TurboGears2 controller as follows:
>
> from tiler.lib.base import BaseController
> from tg import expose, flash
> import pylons
> from pylons.i18n import ugettext as _
> from TileCache.Service import Service, wsgiHandler
> from TileCache.Caches.Disk import Disk
> from TileCache.Layers import Mapnik as Mapnik
>
> myService = Service(
>  Disk("/home/sanjiv/wms-c/cache"),
>  {
>    "osm": Mapnik.Mapnik("osm",
>           mapfile="/home/sanjiv/mapnik/osm.xml",
>           spherical_mercator="true", extension="png")
>  }
> )
>
> class RootController(BaseController):
>
>    @expose()
>    def tiles(self, *args, **kw):
>        return wsgiHandler(pylons.request.environ,
>                        self.start_response, myService)
>
> But I am getting jumbled tiles when loading it as
> OpenLayers.Layer.TileCache layer in openlayers. Actually I am getting
> a distorted tile which is repeated several times to give a jumbled
> look. I have python2.5 on Ubunty Hardy. My mapnik generate_tiles.py
> works correctly and I can see the tiles properly as a TMS layer.
>
> Regards
> Sanjiv
>



More information about the Tilecache mailing list