ThinkGeo.com    |     Documentation    |     Premium Support

Multiple Images

I want to open background images behind my map data.  I have found that all layers seem to be displayed in the order they are added to the map window.  For instance, if I add a layer called roads, and then add an image, the image is diaplayed over the roads layer.  If I add the image layer first, it is displayed under the roads.  I believe that if I add images to the StaticOverlay and map data to the DynamicOverlay the display will work as I want.


My issue is that I want to have landbase data on the StaticOverlay, my customer data on the DynamicOverlay, and still be able to open backdrop images on the fly without them overwriting any map data.  Is this possible?



Charles, 
  
 Here are a couple solutions for this.  
 1, Put both the backdrop images and the landbase data to StaticOverlay, put images on the bottom and the map data on top of if.  In that way, the backdrop images will always shows on the bottom and if you want to turn it off just set its IsVisible properties to false.  
 2) Create 3 overlays correspondingly for the background image, the map data and the customer data, and add them to map’s CustomOverlays in the right order. Overlays also get an IsVisible property which makes you very easy to turn it on or off. 
  
 Hope that solves your problem. Let me know for more queries. 
  
 Thanks, 
  
 Ben 


Ben,


Thanks.  I thought I was going to have to use CustomOverlays.  Do you have any sample code on how to instantiate and use a custom overlay?  I have more than a few question on how to use CustomOverlays and some sample code would probably answer most of them.


If I useCustomOverlays, is the EditOverlay still available?


I have started with the following code:


 



LayerOverlay newOverlay = new LayerOverlay();
newOverlay.Layers.Add(roadLayer.Name, roadLayer);
winformsMap1.CustomOverlays.Add("LandbaseOverlay", newOverlay);


 


This works fine, but I can't figure out how to rewrite the following lines which works with DynamicOverlay:


 



for (int Looper = 0; Looper < winformsMap1.DynamicOverlay.Layers.Count; Looper++)
{
    FeatureLayer currentLayer = winformsMap1.FindFeatureLayer(winformsMap1.DynamicOverlay.Layers[Looper].Name); 



Charles, 
  
 Sorry we didn’t have any sample code about CustomOverlays along with our product, we definitely need to add some in the future version. I can write one quick sample for you but I’m not sure what you want, as you just want to display layers it does not have too many stuff there.  One thing needs to be aware is StaticOverlay/DynamicOverlay are all LayerOverlay while CustomOverlays accepts Overlay, which is the base class of LayerOverlay. So if you want to use GoogleMapOverlay, you have to add it to the CustomOverlays. Anyway, let me know more about your requirements and I’m glad to provide you some demo. 
  
 Here are answers of your question 
 1, EditOverlay will still be available when using customOverlays. 
 2, FindFeatureLayer only check LayerOverlays within StaticOverlay and DynamicOverlay for now. You can work around easily with the following codes. 
 
            Layer featureLayer = null;
            LayerOverlay newOverlay = new LayerOverlay();
            if (newOverlay.Layers.Contains("layername"))
            {
                Layer layer = newOverlay.Layers["layername"];
                if (layer is FeatureLayer)
                {
                    featureLayer = (FeatureLayer)layer;
                }
            } 
 
 Let me know for more queries. 
  
 Thanks, 
  
 Ben 


Ben, 
  
 This is actually a new discussion at this point.  I’ll add a new topic post. 
  
 Charles

Charles,  
  
 That’s easier for people to find the topic. Thanks for that. 
  
 Ben.