[OpenLayers-Users] Setting up a static map cache

Paul Spencer pagameba at gmail.com
Fri Apr 3 08:44:27 EDT 2009


The simpler solution would be to use a TMS layer with a static  
directory structure.  The TileCache directory structure is fairly deep  
and requires some logic to figure out whereas the TMS directory  
structure is very simple (but flatter so you can run into problems on  
some OS/file systems if you have too many directories or files).   
Using TileCache with a static cache(entirely pregenerated) works but  
is unnecessary overhead (if you are concerned about that kind of thing).

The OpenLayers layer for TMS is:

new OpenLayers.Layer.TMS( "TMS",
                     "http://some.server.com/path/", {layername:  
'basic', type:'png'} );

The request for a TMS layer ends up looking like:

http://some.server.com/path/1.0.0/basic/1/2/1.png
the parts you control are the url including path, the layer name and  
the type.  OpenLayers assumes tile sizes of 256x256 and converts  
requests into rows and columns.
If you write your tiles into a directory structure:
path/1.0.0/basic/<zoom level>/<col>/<row>.png
then it will work beautifully!

Cheers

Paul

On 26-Mar-09, at 11:46 AM, Mark Glicksman wrote:

> I have been trying to set up a static map cache with no success.  I  
> would
> like to generate the tiles using an AutoCAD script.  AutoCAD has a  
> function
> that allows it to print PNG files.   Generating the tiles has been no
> problem.  The problem is getting them to display in OpenLayers.  I  
> assume
> that OpenLayers.Layer.TileCache is the thing to use, and I have  
> looked at
> http://www.nabble.com/Can-we-by-pass-TileCache...-to-the-tiles-as-static...-
> what-getURL---tp13943736p13943919.html and
> http://openlayers.org/dev/examples/tilecache.html
>
> Questions:
> If OpenLayers is simply pulling from a pre-made disk cache, why do I  
> need
> Tilecache at all?
> What should the Tilecache.cfg look like?
> How do I confirm that OpenLayers is actually using the tilecache.cfg?
> Are there any docs on how to format the directory and file names for
> diskcache and GoogleDisk?
> Do all the files for all the zoom levels need to be filled or can some
> simply be left out?
>
> Thanks,
> Mark
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list