[mapserver-users] Precache

Guillaume Sueur no-reply at neogeo-online.net
Fri Jun 19 18:55:33 EDT 2009


Hi Varun,

It looks rather like a question for the tilecache-users list, but I can 
give you a hand.
I think you didn't specify any layer when running tilecache_seed.py
Please try :
tilecache_seed.py [your_layer_name_as_set_in_tilecache.cfg] 0 5
where 0 and 5 are zoom start and zoom end. You can adapt this last one 
depending on how many levels you set for your layer.
Run it from the directory where tilecache.cfg is, to avoid problem if 
you have many of them...

Regards,

Guillaume

Varun saraf a écrit :
> Hello,
> 
> I have got this (tilecache with mapserver on google maps) working
> finally after a lot of problems but I now really need to know about
> how to do a pre-cache of all the tiles from mapserver. I am running
> tilecache 2.10 on Windows with mapserver ms4w from maptools.org. I
> tried running "tilecache_seed.py" as per the suggestion above but it
> always ends up in the following error
> 
> Traceback (most recent call last):
>   File "C:\ms4w\Apache\cgi-bin\tilecache-2.10\tilecache_seed.py", line 9, in <mo
> dule>
>     TileCache.Client.main()
>   File "C:\ms4w\Apache\cgi-bin\tilecache-2.10\TileCache\Client.py", line 153, in
>  main
>     layer = svc.layers[args[0]]
> IndexError: list index out of range
> 
> Any help in this regard would be great.
> 
> Thanks,
> Varun
> 
> On Fri, Jun 19, 2009 at 2:39 PM, Varun saraf<vsaraf.gmu at gmail.com> wrote:
>> Hi Roger,
>>
>> I am trying to get my mapserver and tilecache work together but its
>> somehow not working. I am using the same projection as you in all my
>> layers and the mapfile. (This works when I call my mapserver directly
>> from google and hence the projection is right).
>>
>> Here is my mapfile (Only things that might be important).
>>
>> MAP
>>    EXTENT -173 5 -45 75
>>
>>    IMAGETYPE PNG
>>
>>    PROJECTION
>>      "init=epsg:4326"
>>    END
>>
>>    WEB
>>    METADATA
>>     wms_srs             "EPSG:4326 EPSG:900913"
>>    END
>> ....
>>    END
>>
>>    LAYER
>> ....
>>        PROJECTION
>>            "init=epsg:4326"
>>        END
>>    END
>>
>> Next I added the 900913 epsg to the proj.4 of mapserver and made the
>> required changes in tilecache.cfg file as you specified.
>>
>> [google-tiles]
>> type=MapServerLayer
>> mapfile=C:/ms4w/apps/QCTGIS/drawMap.map
>> metaTile=true
>> metaSize=2,2
>> metaBuffer=0,500
>> layers=tr20_d00
>> spherical_mercator=true
>> srs=EPSG:900913
>>
>> I am not sure if the linkn I am using is wrong. I have tilecache
>> installed in the cgi directory of the apache server that was installed
>> using "ms4". The example index.html that comes with tilecache works
>> fine and I can see the images being cached. Also my mapserver directly
>> works fine. Can you tell me what is it that I am doing wrong here? the
>> link I use for the tileUrlTemplate in google maps is
>> "http://127.0.0.1:8123/cgi-bin/tilecache-2.10/tilecache.cgi/1.0.0/google-tiles/{Y}/{X}/{Z}.png?type=google".
>> I can also see that this call gets initiated in the apache logs
>> (access.log) but nothing happens therafter. I don't even know if this
>> is failing at tilecache end and mapserver isn't being called at all or
>> at mapserver's end where the image is not being sent by mapserver. Can
>> you help me out here?
>>
>> Thanks a lot.
>> Varun
>>
>> On Thu, May 21, 2009 at 12:46 PM, Roger André<randre at gmail.com> wrote:
>>> Ahh, ok.  I'm not sure in what fashion you are using TileCache, but my
>>> experience has been with using it to create tiles to display in Google
>>> Maps.  Google Maps uses the projection which is EPSG:900913.  I
>>> believe there are other codes for it, but that is the one I use.
>>>
>>> All of my source data for the MapServer projects I make are in
>>> EPSG:4326.  So there are 3 things I need to do in order to make the
>>> Tilecache output tiles align correctly in Gmaps.
>>>
>>> 1. I set both the mapfile and the layer projections to EPSG:4326.
>>> MAP
>>>  NAME  'v2_80m_global'
>>>  PROJECTION
>>>    "init=epsg:4326"
>>>  END
>>>
>>>  LAYER
>>>    NAME 'imagery'
>>>    PROJECTION
>>>      "init=epsg:4326"
>>>    END
>>> <snip...>
>>>
>>> 2. I explicity allow for a wms request to be made for the layer in
>>> EPSG:900913 by setting the following in my MapServer LAYER:
>>>    METADATA
>>>      "wms_srs"             "EPSG:4326 EPSG:900913"
>>> <snip...>
>>>
>>> 3. I define my TileCache layer so that it requests images from
>>> Mapserver in EPSG:900913.
>>> [v2_20m_global]
>>> type=MapServerLayer
>>> mapfile=/var/www/mapfiles/v2_20m_global/v2_20m_global.map
>>> metaTile=true
>>> metaSize=2,2
>>> metaBuffer=0,500
>>> layers=imagery
>>> spherical_mercator=true
>>> srs=EPSG:900913
>>>
>>> That's what works for me.
>>>
>>> Roger
>>> --
>>>
>>> On Thu, May 21, 2009 at 5:24 AM, Chad Clabaugh <cclabaugh at centwire.com> wrote:
>>>> Thank you Roger, for your response.  I have done that but I do not
>>>> understand how tilecache works.  The images that are returned from mapserver
>>>> line up perfectly. But the images returned from tilecache do not align very
>>>> well (they're distorted).  If tilecache is simply caching the returned
>>>> images then I do not understand where this distortion comes from.  Any
>>>> thoughts?
>>>>
>>>> Thanks!
>>>>
>>>> -----Original Message-----
>>>> From: Roger André [mailto:randre at gmail.com]
>>>> Sent: Wednesday, May 20, 2009 11:46 PM
>>>> To: Chad Clabaugh
>>>> Cc: mapserver-users at lists.osgeo.org
>>>> Subject: Re: [mapserver-users] Precache
>>>>
>>>> Your request is somewhat lacking in detail, but assuming that your
>>>> goal is a simple one, here is one way to accomplish this.
>>>>
>>>> 1. Create a MapServer project that displays your shapefile in whatever
>>>> style you choose.
>>>> 2. Setup a TileCache instance that points to your MapServer project.
>>>> 3. Run the tilecache_seed.py script to pre-generate tiles.
>>>>
>>>> Roger
>>>> --
>>>>
>>>> On Wed, May 20, 2009 at 12:16 PM, Chad Clabaugh <cclabaugh at centwire.com>
>>>> wrote:
>>>>> How can I precache tile images from shapefiles?
>>>>>
>>>>>
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>>
>>>>> Chad Clabaugh
>>>>>
>>>>> Technical Support, Engineering
>>>>>
>>>>> Office: 260.760.6398
>>>>>
>>>>> Mobile: 260.466.8861
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> mapserver-users mailing list
>>>>> mapserver-users at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>>>
>>>>>
>>>>
>>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> 


More information about the mapserver-users mailing list