Vishful thinking…

Are multi-layer caches worth it?

Posted in Uncategorized by viswaug on April 4, 2008

The requirements for one our projects had eliminated the use of single fused cache for the web application. I was doing some research into whether using a multi-layer cache would help the performance of the application given the extensive requirements that we are trying to tackle. I was trying to find some broad guidelines to justify using multi-layer caches for our application. One of the helpful guys at ESRI pointed me to this link in the ArcGIS 9.3 documentation page (I couldn’t find it in the 9.2 documentation) that does just that. http://webhelp.esri.com/arcgisserver/9.3/dotNet/index.htm#choosing_cache_properties.htm (See the “Advanced options (cache type)” section). I think you need to be in the 9.3 Beta program to access the link. If you don’t have access to the link, here is what you need to know.

If you do use a multi-layer cache, ArcMap is the recommended client for working with the cache. Using a multi-layer cache in a Web application provides little or no advantage over using a non-cached map service. The Zoom Level control that appears with fused caches does not appear when you use a multi-layer cache in a Web Mapping Application.

The issue with the zoom level control is supposed to be fixed in 9.3. But the recommendation on using ‘ArcMap’ as the client still should hold true. So, if you are thinking about using multi-layer caches in your application, keep that in the back of your mind. But this does make me wonder as to how many people are actually using multi-layer caches with any kind of success in their web applications…

Should you care about the "UseMimeData" property on the .NET ADF Map control?

Posted in Uncategorized by viswaug on April 4, 2008

The ‘UseMimeData’ property tells the ADF whether to request a stream of bytes or a URL. This property is set to TRUE by default. In this case, the ADF is going to store the stream of bytes for the map images into the session storage. If the property is set to false, the image is written to disk in the virtual directory specified and passed back to the browser as a URL. Setting the ‘UseMimeData’ property to TRUE and streaming images from the session is fine when the in-process session storage is used. But other providers like SQL Server is used for storing the session, it is wise to set this property to FALSE and return URLs. This will save the added overhead of serializing everything into the SQL database on each map draw or other draw operations. Setting this property to FALSE will force the MapServer to use its output directory to write out the images and the associated URL will be passed on to the browser. When specifying the path for the virtual directory property on the map control, specify a relative path as an absolute path doesn’t seem to work.

Adding a map resource dynamically to the map using the .NET ADF

Posted in ArcGIS, ESRI by viswaug on April 1, 2008

I just completed a feature in our current project allowing the user to be able to select the map resource to view from a list box and have the map loaded with the selected resource. To accomplish this, we had to add map resources to the map dynamically without it being preset on the MapResourceManager using the Visual Studio designer. Here is a code snippet to insert a “ArcGIS Server Local” map resource into the map.

private MapResourceItem AddMapResource(Map map, AGSLocalMapService mapService, int index)

        {

            MapResourceManager mrm = map.MapResourceManagerInstance;

            MapResourceItem mri = new MapResourceItem();

            GISResourceItemDefinition definition = new GISResourceItemDefinition();

            mri.Name = mapService.Name;

            definition.DataSourceDefinition = mapService.MapServerName;

            definition.DataSourceType = “ArcGIS Server Local”;

            definition.ResourceDefinition = mapService.DataFrame + “@” + mapService.MapService;

            definition.DataSourceShared = true;

            mri.Parent = mrm;

            mri.Definition = definition;

            DisplaySettings displaySettings = new DisplaySettings();

            displaySettings.DisplayInTableOfContents = true;

            displaySettings.Visible = true;

            displaySettings.ImageDescriptor.ImageFormat = ImageFormat.PNG24;

            mri.DisplaySettings = displaySettings;

 

            mrm.ResourceItems.Insert(index, mri);

            mrm.CreateResource(mri);

 

            return mri;

        }

and the snippet to insert a graphics resource item.

public static MapResourceItem AddGraphicsMapResource(Map map, string graphicsResourceName)

        {

            if (map != null)

            {

                MapResourceItem mapResourceItem = new MapResourceItem();

                GISResourceItemDefinition graphicsDef = new GISResourceItemDefinition();

                graphicsDef.DataSourceDefinition = “In Memory”;

                graphicsDef.DataSourceType = “GraphicsLayer”;

                mapResourceItem.Definition = graphicsDef;

                DisplaySettings graphicsDisplay = new DisplaySettings();

                graphicsDisplay.DisplayInTableOfContents = false;

                //graphicsDisplay.Transparency = 50.0F;

                graphicsDisplay.Visible = true;

                mapResourceItem.DisplaySettings = graphicsDisplay;

                mapResourceItem.Name = graphicsResourceName;

                map.MapResourceManagerInstance.Initialize();

                map.MapResourceManagerInstance.ResourceItems.Insert(0, mapResourceItem);

                map.MapResourceManagerInstance.CreateResource(mapResourceItem);

                return mapResourceItem;

            }

            return null;

        }