ThinkGeo.com    |     Documentation    |     Premium Support

Overlay Types

Hi,


I see in the web edition there are StaticOverlays, DyanamicOverlays & CustomOverlays.  Can you tell me what the differences are between these types and when I would use one over the other or some best practices?


Thanks!




 



 Clint,


 First we should make sure what an “Overlay” is. In MapSuite Web, Overlay is a client part layer, which represents an image in client. For example, I have 3 shape files let's say they are country, cities and rivers. I group them into 2 overlays, one is for country and rivers, the other is for cities. That means although I have 3 layers on server, I only get 2 images on client. The country and rivers are drawn in one image and the cities layer gets its own image. 
 
StaticOverlay and DynamicOverlay are just 2 "Overlays", here is the difference between them:
 
             StaticOverlay is a base overlay; it’s on the bottom of all overlays and appears on OverlaySwitcher with a radio button in front, it gets TileType.MultiTile by default. You can create a staticOverlay with the following code and add it to CustomOverlays, it is the same.
 
            LayerOverlay staticOverlay = new LayerOverlay(“StaticOverlay”);
            staticOverlay.TileType = TileType.MultiTile;
            staticOverlay.IsBaseOverlay = true;
 
            DynamicOverlay draws on top of all base overlays. In the OverlaySwitcher, it appears with a checkbox button in front, you can create a dynamicOverlay with the following code and add it to CustomOverlays, it is the same.
            
            LayerOverlay dynamicOverlay = new LayerOverlay(“DynamicOverlay”);
            dynamicOverlay.TileType = TileType.SingleTile;
            dynamicOverlay.IsBaseOverlay = false;
 
            If you are using StaticOverlay and DynamicOverlay, which means you can only add 2 overlays (one base overlay and one dynamic overlay) on the map. We recommend you to use CustomOverlays which provides you more power, in this way, you can set GoogleOverlay, VirtualEarthOverlay LayerOverlay… as base overlays, and you can switch them by OverlaySwitcher between each other. 
 
            In the next version, we’ll add some new preset overlays like BackgroundOverlay, MarkerOverlay, and all the preset overlays will be ignored when you use CustomOverlays.
 
Hope that makes sense. Let us know for more queries.
 
Ben 
 
 
 
 
 

Ben, 
  
 Thanks for the reply!  I think I’m starting to understand but have some follow up questions.   
  
 So if I understand correctly there are two different modes of use with Overlays.  There is the simple mode using Static and Dynamic Overlays which is good for a simple case where you only need a base map and the ability to draw stuff on top of it.  In this case on the layer switcher you would only have one radio button for the base map that would always be selected and a check box for the Dynamic data.   
  
 The other mode if I understand correctly is the Custom Overlays Method.  Using this method it sounds like you can add as many groupings of overlays as you like which in turns add to more selections on the layer switcher.  Now assuming I understood things correctly here are my questions. 
  
  
 1.  Can you use Static & Dynamic Overlays in Conjunction with Custom Overlays or is it one mode or the other? 
  
 2.  I notice that Custom Overlays don’t have the same methods as Static & Dynamic.  For example there is no Redraw method or ClientCache property.  Does this mean custom overlays have less functionality or is there another way to implement caching and tell the overlay to redraw? 
  
 Thanks! 
  
  
  
  


Clint, 
  
 I think you’ve got a very good understanding about overlays already. Here are the answers of your 2 additional questions.  
   
 1, Static & Dynamic Overlays and Custom Overlays cannot be used together. As you thought, it is one mode and the other. Once you add an overlay to CustomOverlays, map control will not check static overlay or Dynamic overlay any more. As a bug, you can use them together with the current version (2.0.117) but we will correct it in the coming version.  
 In fact, you can find this pattern more than one place in Map Suite 3.0. For example, ZoomLevel has DefaultStyles(DefaultPointStyle, DefaultLineStyle, ……) and CustomStyles, if you add one style to the CustomStyles, all the default styles will be unavailable.  
   
 2, we have less control on third-part overlays like GoogleMapOverlay, VirtualEarthOverlay…, we cannot manage their cache system and make them redraw. While the Static & Dynamic Overlays are made of our own layers on which we have more control, that’s why there are more functions for the Dynamic/Static overlays.  
  
 Ben. 


So to help clairify:  
  
 The GoogleOverlay and VirtualEarthOverlay are CustomOverlays and thus must be used in the CustomOverload model. True?  
  
 In the future will there be the following preset Overlays for the simple mode?  
 BackgroundOverlay  
 StaticOverlay  
 DynamicOverlay  
 MarkerOverlay  
  
 I am curious if the above is true will I be able to use a Google Map as my BackgroundOverlay or if I will have to switch to the CustomOverlays mode?


 Steve 
  
 In the current version (3.0.131), we already have the predefined Overlays as you mentioned.  
 BackgroundOverlay  
 StaticOverlay  
 DynamicOverlay  
 MarkerOverlay 
  
 StaticOverlay and DynamicOverlay are LayerOverlay, which means you can only add Map Suite Layers to StaticOverLay/DynamicOverLay 
 MarkerOverlay is an InMemoryMarkerLayer, it is just for adding markers. 
 BackgroundOverlay is an base Overlay, that means it can be a GoogleMapOverlay, VirtualEarthOverlay, WmsOverlay, LayerOverlay……., whatever the overlay is, you can set it here.  
 CustomOverlay is a collection of base Overlays, so you can add whatever an overlay to this collection. 
  
 I think now you have got the answer already that if you want to use GoogleMap as the background, you can use CustomOverlays of course; also you can set it to BackgroundOverlay. All the predefined overlays will be ignored if you are using CustomOverlays. 
  
 I hope that makes sense to you. Any queries please let us know. 
  
 Ben