Building a Tile Cache

Weave provides the tools to allow you to build a tile cache based on an existing server side map engine.

To build the tile cache you need to configure a client configuration to use a tile cache, as outlined in the section on Tile Caching, then use the 'tilecache' command from the osgi console to get Weave to build the appropriate tiles.

When building a tile cache there is the extra configuration requirement that there must be a server side map engine available to generate the tiles from, this can be any of the map engines supported by Weave.
To setup the link between the tile cache and the server side map engine you need to tell the client map engine what server map engine to use and what layer within that map engine to turn on, this is done by adding a 'server' option

<mapengine id="mapengine.aerial.tile">

Where the mapengine is the id of the server side map engine and layers is a comma separated list of the layer ids in that map engine that you want turned on.

The tilecache command

Configuring the tilecache command

Executing the tilecache command by itself at the osgi console will display the default setting that will be used to generate the cache

osgi> tilecache
--- TileCache ---
base      	 ...\platform\workspace\.tilecache
extent    	 full
force     	 false
format    	 jpeg
metatile  	 true
metasize  	 3
metabuffer	10

To change any of the setting you use the tilecache command again, this tile with the 'set' command

osgi> tilecache set base z:\www\tilecache

Any changes made to these settings are kept in the osgi configuration area, so they should persist unless you clean out the configuration directory or start Weave with the -Dosgi.clean parameter




The base directory where the files will be written to


Which extent, full, initial or limit, to use as the bounds for the tile cache


Should existing files be overwritten when generating the cache


What format, jpeg, png or gif, should the tiles be generated in


Should the tilecache command fetch a larger map from the map engine and split it up to make the tiles, which helps with performance when generating the tile cache


How much bigger should the map image request be, the tilecache command will request a map images that are metasize x metasize tiles from the map engine


How many pixels extra around the meta tile should the tilecache command request the map image, which helps to ensure that there are no gaps between tiles

You will want to at least update the base setting to ensure that the tile are generated in a more appropriate location. Which would generally be directly to a directory that's already being served out by a web server, otherwise the file will need to be copied to a web server once generated

Running the tilecache command

Once the tilecache command has been configured and the client configuration is setup correctly you use the tilecache 'seed' command from the osgi console to actually build the tiles.

At the simplest, if you only have a single map engine configured in the client configuration then you can just start the seed command with the id of the client configuration as the only parameter

osgi> tilecache seed main

But if you have multiple map engines in the client configuration then you also need to provide the name of the map engine

osgi> tilecache seed main mapengine.aerial.tile

Additionally you can override some of the default tilecache setting in the command

osgi> tilecache seed main mapengine.aerial.tile force=true

There are two additional parameters that the seed command understands, that aren't configurable by the tilecache set command, and they are 'minlevel' and 'maxlevel'.
These two parameter allow you to set the levels of the tile cache that you want generated, this way you do not have to re-generate the entire tile cache if only data at one scale has changed, so to only generate the second level

osgi> tilecache seed main mapengine.aerial.tile minlevel=1 maxlevel=2

The minlevel defaults to 0 and the maxlevel defaults to the number of scales plus 1, since minlevel is inclusive and maxlevel is exclusive.