|     Documentation    |     Premium Support

WmsRasterLayer - Pixelation due to Caching

MapSuite Team,

We are encountering pixelation of WmsRasterLayer at ZoomLevel19 (Scale 563) and ZoomLevel20 (Scale 282). This only occurs when caching is enabled. If caching is disabled the imagery is rendered properly. Below are screen captures of a pixelated and non-pixelated example.

The client application does not use the standard default ZoomLevelSet values. Attached is a text file which has the ZoomLevelSet that is used (Detail) and the default (Standard).

You may recall that our environment is such that all the clients make WmsRasterLayer requests via a local central server (running ThinkGeo.MapSuite.WmsServer). The local server, in turn, passes said requests to a third-party WMS Provider (nearmap). The versions of WmsServer DLL’s being used are:

ThinkGeo.MapSuite.dll V11.0.0-beta135
ThinkGeo.MapSuite.WmsServer.dll V11.0.0-beta006
ThinkGeo.MapSuite.Layers.Wms.dll V11.0.0-beta019
ThinkGeo.MapSuite.Layers.TiledWms.dll V11.0.0-beta018

Below is a screen capture of the WmsServer Cached Directory Structure. Notice that the directory naming does not exactly match the scales being used. Instead of 1128, 2256, and 4513 we have ZoomLevelSet values of
ZoomLevel18 - 1126
ZoomLevel17 - 1900
ZoomLevel16 - 4505

Also notice there are no directories for ZoomLevel19 (563) and ZoomLevel20 (282) even though the map was zoomed to those levels.

Below is code from WmsServer showing FileBitmapTileCache properties.

It seems to me that WmsServer Caching is not handling non-standard ZoomLevelSet.

Your thoughts?

OriStar Mapping, Inc.


                // instantiate TimeSpan Object
            TheTimeSpan = new TimeSpan(12, 00, 00);

            // instantiate TileMatrix Object
            TheTileMatrix = new MapSuiteTileMatrix(147647947);

            // instantiate TileCache Object
            TheFileBitmapTileCache = new FileBitmapTileCache();

            // set TileCache Object properties
            TheFileBitmapTileCache.CacheDirectory = "TheDirectory";
            TheFileBitmapTileCache.CacheId        = "TheCacheId";
            TheFileBitmapTileCache.ExpirationTime = TheTimeSpan;
            TheFileBitmapTileCache.TileAccessMode = TileAccessMode.ReadAddDelete;
            TheFileBitmapTileCache.TileMatrix     = TheTileMatrix;
            TheFileBitmapTileCache.ImageFormat    = TileImageFormat.JPeg;

            TheMapConfiguration.TileCache         = TheFileBitmapTileCache;

ZoomLevelSetTable.txt (2.7 KB)

Hi Dennis,

Would you please provide more clarification on following

  1. Your client application (WmsRasterLayer) using V12 or V10?
  2. You mentioned when caching is enabled, the imagery getting pixelated, do you mean enable caching on WmsRasterLayer(client side) or on WmsServer (server side)? I am a little confuse here because you are attaching WmsServer caching code in the post as well.
  3. Does the screen captures of a pixelated and non-pixelated example image taken from client side or WmsServer?
  4. You mentioned “It seems to me that WmsServer Caching is not handling non-standard ZoomLevelSet”. I am uncertain about this, if the WmsRasterLayer(client side) renders image properly when RasterLayer cache (client side cache) disabled, which means WmsServer is handing the image properly even in non-standard zoomlevel set.

Regarding no directories for ZoomLevel19 (563) and ZoomLevel20 (282) on WmsServer Cache directory – my assumption is that the data provider does not provide imagery above scale 1126 (zoom 18), and WmsServer is stretching image for client request scale 563 (zoom 19) and scale 282 (zoom 20).



hi Jack,


  1. The pixelation occurs on the client under both V10.6 and V12.1.

  2. Enabling/Disabling Caching on the Server. There is no WmsRasterLayer client caching.

  3. The screen captures are from the client.

  4. Caching is on the Server.

The imagery from the data provider is displayable above Scale1126. This is evidenced when caching is disabled there is no pixelation.


Hi Dennis,

I think the root cause of the issue was due to ZoomLevel19 (Scale 563) and ZoomLevel20 (Scale 282) cache image not been generated. When WmsServer cache turned on, there is a bug that cache files only been generated up to scale 1126 (zoom18 in your case). WmsServer response Zoom 19 (Scale 563) and Zoom 20(Scale 282) requests by fetching cached image from zoom 18 file cache, instead of fetching from raster data provider.

To fix the issue we will need a new property on the mapConfiguration object, to pass-in custom ZoomLevelSet for caching, that we can properly cache customized zoomLevelSet images.
The code change been pushed, and will be available in NuGet later today (afternoon), please check out package: ThinkGeo.MapSuite.WmsServer V11.0.0-beta007 and above.

Here’s a code snippet of change needed on WmsServer side (TheMapConfiguration.ZoomLevelSet)

      TheMapConfiguration.TileCache         = TheFileBitmapTileCache;
        // Create a ZoomLevelSet object matching with your application
        ZoomLevelSet zoomLevelSet = new ZoomLevelSet();
        double scale = 147647947;
        // Add 20 zoomLevels, and first zoomlevel scale is 147647947
        for (int i = 0; i < 20; i++)
            zoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(scale / Math.Pow(2, i)));
        TheMapConfiguration.ZoomLevelSet = zoomLevelSet;

Please give a try and let us know how it works.

hi Jack,

Thanks very much for the update.

I’ll update our applications, test, and let you now the outcome.


hi Jack,

I implemented the new WmsServer.dll and your suggested code.

The pixelation still occurs with caching enabled. If caching is disabled imagery is rendered properly.


Hi Dennis,
Can you check the cache folder, and verify if Zoom 19 (Scale 563) and Zoom 20(Scale 282) cache file been generated?


I had verified at the time of my testing and found those cache folders were not created.


Hi Dennis,
Can you send your WmsLayerPlugin code to, would like to go over the code to find out why the server doesn’t response zoom 19 and 20 properly.


Thanks for the hint by asking for the code as I wanted to first review before passing it on to you. After doing a review it appears that I have overlooked how I’m setting up MapConfiguration. I need to look this over and I will get back to you.


hi Jack,

My apologies!!! I had neglected an item in the coding.

The application code has been corrected and now the imagery is rendered properly.

The cache folders are also created for ZoomLevel19 & ZoomLevel20.

Thanks for the updated WmsServer.dll…


Great! Glad to know it’s been fixed and work well for you.
As always, feel free to let let us know if you have questions.