Tile caching is useful in many scenarios, particularly for static data that does not change frequently. Determining the best caching approach is not trivial as there are many interrelated factors to consider:
Based on the answer to these questions you may find yourself up against an insurmountable requirement. For example, if your challenge is to cache the entire continental US from zoom level one all the way down to zoom level 20 and your map has five layers all of which must be randomly accessible to the end-user and cached, then you will have to rethink your requirement. The number of tiles to cache in this scenario is roughly 55 billion tiles. If your rendering farm is able to render say 150 tiles per second, then it would take roughly 11.6 years to render your cache; probably several years longer than your application's lifespan.
To compute an estimated number of tiles in a cache, use the following formula:Ntfe * (4 ^ (Zmax - Zmin)) * 1.3 * Lp Ntfe- number of tiles at the full extent of your data at the minimum zoom level Zmax - max pyramid zoom level Zmin - min pyramid zoom level Lp - layer permutations (for example if you have 5 layers with complete random visibility access, this results in 31 permutations or (2^L)-1
How can I reduce the number of tiles in my cache?
How do I create a Tile Cache in Studio?
Notes on preloading using Studio
MapDotNet UX Tile Cache Preloader Version 1.0.0 - Copyright 2008, ISC
TileCachePreloader [path] -c -b? -i? -rt? -t? -p?[path] required path to tile cache preloader config file-c optional close console automatically on completion-b? optional bleed ratio from 1.0 (default) to 2.0-i? optional image type (jpg, gif, png[default])-rt? optional request threads (defaults to 4)-t? optional timeout seconds (defaults to 30)-p? optional projection EPSG (defaults to 3785)
Notes on the preloader
Creating Large Tile Caches
How to setup Map Caching on the Server1. Create table in a database for tile storage
Scripts for PostGIS
CREATE TABLE "mapCache"(id serial,cachekey varchar(28) NOT NULL,mapid varchar(256) NOT NULL,item text NOT NULL,writetime timestamp NOT NULL,CONSTRAINT "mapCache_pk" PRIMARY KEY (id)) WITHOUT OIDS;
-- ALTER TABLE "mapCache" OWNER TO pguser;
-- DROP INDEX "mapCache_cachekey_uidx";
CREATE UNIQUE INDEX "mapCache_cachekey_uidx"ON "mapCache"USING btree(cachekey);
Scripts for Microsoft SQL Server 2008
CREATE TABLE [mapCache]([id] [int] IDENTITY(1,1) NOT NULL,[cachekey] [varchar](28) NOT NULL,[mapid] [varchar](256) NOT NULL,[item] [text] NOT NULL,[writetime] [datetime] NOT NULL,CONSTRAINT [PK_mapCache] PRIMARY KEY CLUSTERED ( [id] ASC ));
-- DROP INDEX [mapCache_cacheKey_uidx];
CREATE UNIQUE NONCLUSTERED INDEX [mapCache_cacheKey_uidx] ON [mapCache] ([cachekey]);
2. Update the in the MapDotNet UX Services web.config file located by default at 'c:\program files\mapdotnet\7.0\service'
Uncomment the MapCacheAssemblyName, MapCacheClassName and the appropriate database connection lines.
Sample entry in Web.config
3. Refresh the MapDotNet UX Server in IIS