ThinkGeo.com    |     Documentation    |     Premium Support

Require sample that uses FileBitmapTileCache

Hi

I require a sample of code that uses FileBitmapTileCache in WMS Server. My previous code was written on MapSuiteCore 6.0 and is unable to run on MapSuiteCore 9.0

Please provide a snippet or sample of how to use the FileBitmapTileCache as read-only.

The tiles are already created using a separate process. I just need an example for comparison on technique to use the API.

My application worked fine with MapSuiteCore 6 and 7.

Hi Andrew,

Please download the “Map Suite WmsServer Edition Web How Do I Samples” I mentioned in post 7927 at first.

Then download the attached pre.zip (1.4 MB), this file is the pre-generated tiles with watermark, bu default please unzip it into disk D.

And you can open the DisplayASimpleMapWmsLayerPlugin.cs file then replace the GetMapConfigurationCore function by the code as below:

protected override MapConfiguration GetMapConfigurationCore(string style, string crs)
    {
        // Get the directory to the sample data
        string worldLayerFilePath = Directory.GetParent(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).FullName).FullName + Path.DirectorySeparatorChar + "SampleData" + Path.DirectorySeparatorChar + "Countries02.shp";

        // Create the world layer from a shapefile and add a style to it
        ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(worldLayerFilePath);
        worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
        worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

        // Create a MapConfiguration and add the layer to it
        MapConfiguration mapConfiguration = new MapConfiguration();
        mapConfiguration.Layers.Add("WorldLayer", worldLayer);

        FileBitmapTileCache cache = new FileBitmapTileCache(@"D:\", "pre");
        cache.TileAccessMode = TileAccessMode.ReadOnly;
        mapConfiguration.TileCache = cache;

        return mapConfiguration;
    }

I tested that with our latest dll, it works well.

Regards,

Don

Thank you for the reply don

Alas , my existing code uses the same technique of using the tilecache and it worked until version 9. (Was written for mapsuitecore 6 and upgraded from there).

My current issue seems more specific because the exception i get with mapsuitecore 9 only occurs on a very specific case, which is when the BBOX is outside of the world and my layer is a GdiPlusRasterLayer.

It seems that there is a specific combination which causes the exception. In MapSuiteCore 8, the API would return a tile even if out of bounds.

Hi Andrew,

Please see the other thread MapSuiteCore 8.0.0.351 FileBitmapTileCache overdrawing

Thanks,
Peter