Hi Khalil,
Your example worked perfectly for a large shape file at world extent such as the countries map.
We have numerous shape files that are of higher detail and they appear from Zoom Level 8 to Zoom Level 20.
When I precompiled the cache for this. [Adding the CacheID also].
BitmapTileCache tileCache = new FileBitmapTileCache(cachePath, clienCacheID, TileImageFormat.Png, tileMatrix);
4 hours later PC was happily churning its way through the first out of 114 shape files Zoom Levels 8 to 19 and has [so far] created an impressive 140,000 files with zoom level 19 containing 100,000 files. [I'm resisting the temptation to open this folder in Windows Explorer in thumbnail view! :)]
Anyway, unless there is something inherently wrong I think that the caching strategy needs to be revised a little on my side.
Zoom levels 6-18 contain 41,000 files per tile * 114 tiles = 4,674,000 files
Zoom levels 6-17 contain 10,800 files per tile * 114 tiles = 1,231,200 files
Are these typical numbers for precompiled files in a WMS server. I note the specs for the machines and how long it takes to generate the tiles here in Davids response here gis.thinkgeo.com/Support/Dis...aspx#19489 so it may not be far off but I'm just checking.
The area of interest that we require high performance and high detail on is approx a 100 mile square area.
Would an amended strategy be to precompile up to level 17 and cache on demand the remaining zoom levels at the server. We would also use client caching. [My plan at the minute is to stick to one base overlay and not allow the user to switch between static overlays at all.].
Given time and resources we could go up to zoom level 18 but may run into deployment issues unless we can agree to precompile the maps on a customer site.
In the web app for zoom levels up to 17 we will point to the cache and for 17 to 20 I assume if it does not see the cached image it will generate it and then use it the next time on the server or do I need to set the TileAccessMode accordingly.
Implementation
------------------
The File Structure is as follows MapCache\ShapeFileName\9011.7155456543\10393\ etc as I have set the CacheID to the Shape file name when creating the Cache. [Each shape filename is unique]
On the Web client end I had assume that consuming the tiles would be as simple as creating a FileBitmapTileCache, setting the cache folder once and for each of the 114 ShapeFileFeatureLayer objects that I load I set the CacheId to the file name
mapConfiguration.TileCache.CacheId = shapeFileName // this will ensure a differnt cacheID for each ShapeFileFeatureLaer
This I assume will point to the correct cache store.
Are the above assumptions correct or have I lost my way [Its late and likely that I may have. :)]
In the event that the cache is not there I assume that the shape file will be rendered and that this implies that I set the required properties for the ShapeFileFeatureLayer regardless of whether I believe it to be cached or not. i.e. Properties such as IndexPathFileName , Zoom levels
[code]
FileBitmapTileCache tileCache = new FileBitmapTileCache(mapCacheFolder);
// I'm loading the shape files from a XML file
foreach (XElement level1Element in XElement.Load(mapConfigFile).Elements("Layers").Elements("Layer"))
{
shapeFileName = mapFolderLocation + level1Element.Element("ShapeFile").Attribute("Value").Value;
mapConfiguration.TileCache.CacheId = Path.GetFileName(shapeFileName);
// set the remaining properties of the shape file even if the cache is expected ....
}
Is there an easy way to tell at the server when a cache tile was used or if a cache tile was deemed to be unavailable and a shape file was used to render the image required
Further Clarification
---------------------------
There another thing I'm slightly unclear of also.
A static layer may consist of multiple Shape File Feature Layers in the one location.
ShapeFileFeatureLayer 1 = rivers
ShapeFileFeatureLayer 2 = county boundary
ShapeFileFeatureLayer 3 = Road + streets
When rendered without caching the 3 ShapeFileFeatureLayer above overlap as expected to form the full picture of an area with a river, county boundary and a road.
When caching is enabled it seems that each ShapeFileFeatureLayer has its own set of tiles at a particular zoom level.
ShapeFileFeatureLayer 1 = set of images
ShapeFileFeatureLayer 2 = separate set of images
ShapeFileFeatureLayer 3 = separate set of images again
Is there a way when caching to somehow indicate that those 3 layers are in the same region and can be covered by 1 set of images which make up an image of the 3 layers combined instead of 3 separate sets of images from each layer.
It would cut down on the amount of images required and the amount of requests made. Just wondering, maybe the gains made are not as big as I imagine them to be or maybe its a difficult thing to do properly.
Rgds,
Liam