[mapserver-users] Precache

Varun saraf vsaraf.gmu at gmail.com
Fri Jun 19 11:39:43 PDT 2009


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
>



More information about the MapServer-users mailing list