Prev Next

Seeding a map cache


In this tutorial you will learn how to create public layers (plain and merged) and how to seed the map cache for them.

Giscuit uses TileCache to create tiles for public access. By default when you create public layer it will try to create the cache automatically on demand, in other words when you first access a certain area in your browser the tiles for it will be created and the next time you or other users access it tiles will be pulled from the cache.

The downside of the on demand tile generation is that a lot of CPU and memory is used at that moment to create them and if you get hit by a lot of users they will probably overwhelm your server. That's where seeding comes in, it will go through all zoom levels and pregenerate all the tiles images that later can be served very quickly and mostly will use I/O and bandwidth.

Publishing a layer

Publishing a layer as an overlay is easy, just go to Administrator panel then Layers and right click edit on the desired layer in the Manage Layers section. Navigate to Publish tab and set Publish destination to "overlay". If you want the layer to be selected by default, check the Selected checkbox. Submit to save the changes.

Often you need to merge multiple layers into one overlay or a base layer to reduce the number of image requests the browser makes to the server. For example I have roads, buildings, rivers, rail roads layers and I want to merge into 1 layer called "My map". Go to Administrator panel then Layers and click Add in Merged layers section. Choose a name "My map" for example, make it active and Submit. Now we want to add some layers to our merged layers, choose a layer you want to add to your merged layer and repeat the procedure you done for making the layer an overlay but as you will notice the Publish destination now has an option with our merged layer name, select it and press Submit, now your layer is a part of the merged layer.


The utility will seed tiles in a cache automatically. You will need to have TileCache set up in one of the previously described configurations. You can find complete documentation on TileCache here:

Usage [options] <layer> [<zoom start> <zoom stop>]


  • --version: show program's version number and exit
  • -h, --help: show this help message and exit
  • -f, --force: force recreation of tiles even if they are already in cache
  • -b BBOX, --bbox=BBOX: restrict to specified bounding box
  • -p PADDING, --pading=PADDING: extra margin tiles to seed around target area. Defaults to 0 (some edge tiles might be missing). A value of 1 ensures all tiles will be created, but some tiles may be wholly outside your bbox


layer: same layer name that is in the tilecache.cfg zoom start: Zoom level to start the process zoom end: Zoom level to end the process

Layer name

When you are editing a layer or a merged layer in Administrator panel notice in the top left you have Class - $name where $name is your layer name that will be used in TileCache commands.


Run the following commands in terminal:

cd /path/to/giscuit/public/tilecache
sudo -u www-data ./ "Worldboundaries" 1 4 -b "-20037508,-20037508,20037508,20037508"
  • Worldboundaries: layer name
  • "-20037508,-20037508,20037508,20037508": specified bounding box
  • 1 4: Seed from level 1 (including) to level 3 (including)
Use sudo to create tiles as Apache user (www-data), this will allow on demand generation of tiles work for the levels that are not being seeded.


Run the following commands in command prompt (cmd.exe) :

cd C:\ms4w\Apache\htdocs\giscuit\public\tilecache "Worldboundaries" 1 4 -b "-20037508,-20037508,20037508,20037508"
  • Worldboundaries: layer name
  • "-20037508,-20037508,20037508,20037508": specified bounding box
  • 1 4: Seed from level 1 (including) to level 3 (including)

Prev Up Next
Editing rules Administrator Developer