ThinkGeo.com    |     Documentation    |     Premium Support

Difference between DynamicOverlay and StaticOverlay

 I created an InMemoryFeatureLayer and I added features to it. I don't see any difference on the map whether I add the InMemoryLayer to the StaticOverlay or DynamicOverlay collection of the Map and the API Documentation does not explain. What is the difference between the two? In what scenarios would I place my InMemoryFeatureLayer in one rather than the other?



Adolfo,  
  
 If you only want to show a couple of LayerOverlays, you can use the StaticOverlay / DynamicOverlay. If you want to use other Overlays (like GoogleMapOverlay) or you want to use more than 2 LayerOverlays, you need to use the CustomOverlays. 
  
 StaticOverlay / DynamicOverlay is for the simple scenario, it simply divide your layers into 2 groups, one represents a static image which seldom changes like the map background, the other is relatively “dynamic” which has chances to be updated in the application, for example a small car running on the road. Here are the differences between the 2: 
 1, DynamicOverlay is always on top of  the StaticOverlay. 
 2, StaticOverlay by default is a baseOverlay while DynamicOverlay is not. At one time, one map can only have one baseOverlay but can have multi UnBaseOverlays. In OverlaySwitcher, a baseOverlay is with a radioButton(so you can select only one) and an UnbaseOverlay is with a checkbox(so you can multi select). 
 3, StaticOverlay uses Tiling by default but DynamicOverlay doesn’t 
  
 Hope that helps. 
  
 Thanks, 
  
 Ben

Is this answer still valid for Version 9 desktop edition. As I didn’t find StaticOverlay object, but only layerOverlay. Here is the code from HideOrShowAFeatureLayer example:

   private void ShowHideLayer_Load(object sender, EventArgs e)
    {
        
        winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
        winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

        ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp");
        worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
        worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

        WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay();
        winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);

        LayerOverlay staticOverlay = new LayerOverlay();
        staticOverlay.Layers.Add("WorldLayer", worldLayer);
        
        winformsMap1.Overlays.Add("WorldOverlay", staticOverlay);

        winformsMap1.CurrentExtent = new RectangleShape(-139.2, 92.4, 120.9, -93.2);
        winformsMap1.Refresh();
    }

Hi Sunshine,

The static overlay and dynamic overlay is only valid for WebEdition.

From your code, it looks you are using desktop edition.

Desktop edition only contains overlays, the overlay order decided by when you add the overlay into maps.overlays.

Regards,

Don