+ Reply to Thread
Results 1 to 5 of 5

Thread: For services added programmatically, ID is not displayed in Map Contents

  1. #1
    Samit Chakraborty
    Join Date
    Feb 2012
    Posts
    11
    Points
    0
    Answers Provided
    0


    0

    Default For services added programmatically, ID is not displayed in Map Contents

    Hi,

    I am trying to add FeatureLayer, ArcGISDynamicMapServiceLayer, and ArcGISTiledMapServiceLayer programmatically through code.
    However although the services get added, I am unable to see their IDs.
    Attached is a screenshot (IDs not displaying1.jpg).
    Is this a bug with ArcGIS API for Sharepoint 2.1.1?
    The code I am using used to work perfectly fine with ArcGIS API for Sharepoint 2.0, that is the ID for each service would appear.

    Code I am using is below (Note: I am setting the ID property everywhere):-

    if (((SecuredServiceList)(lstBox.Items[index])).Tick == true && ((SecuredServiceList)(lstBox.Items[index])).LayerType == "FeatureLayer")
    {
    FeatureLayer layer = new FeatureLayer()
    {
    Url = ((SecuredServiceList)(lstBox.Items[index])).Name,
    ID = ((SecuredServiceList)(lstBox.Items[index])).ID,
    ProxyUrl = proxyurl
    };

    layer.Where = "1=1";
    layer.OutFields.Add("*");

    layer.InitializationFailed += layer_InitializationFailed;
    MapApplication.Current.Map.Layers.Add(layer);
    }

    if (((SecuredServiceList)(lstBox.Items[index])).Tick == true && ((SecuredServiceList)(lstBox.Items[index])).LayerType == "RasterLayer" && ((SecuredServiceList)(lstBox.Items[index])).ContainsTileInfo == true)
    {

    ArcGISTiledMapServiceLayer layer = new ArcGISTiledMapServiceLayer()
    {
    Url = ((SecuredServiceList)(lstBox.Items[index])).Name,
    ID = ((SecuredServiceList)(lstBox.Items[index])).ID,
    ProxyURL = proxyurl
    };

    layer.InitializationFailed += layer_InitializationFailed;
    MapApplication.Current.Map.Layers.Add(layer);
    }



    if (((SecuredServiceList)(lstBox.Items[index])).Tick == true && ((SecuredServiceList)(lstBox.Items[index])).LayerType == "RasterLayer" && ((SecuredServiceList)(lstBox.Items[index])).ContainsTileInfo == false)
    {

    ArcGISDynamicMapServiceLayer layer = new ArcGISDynamicMapServiceLayer()
    {
    Url = ((SecuredServiceList)(lstBox.Items[index])).Name,
    ID = ((SecuredServiceList)(lstBox.Items[index])).ID,
    ProxyURL = proxyurl
    };

    layer.InitializationFailed += layer_InitializationFailed;
    MapApplication.Current.Map.Layers.Add(layer);
    }

    Has anyone faced a similar problem and come up with a resolution?
    Thanks.


    -- Samit
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	IDs not displaying1.jpg‎
Views:	59
Size:	135.1 KB
ID:	12007  
    Last edited by samitchakraborty; 02-16-2012 at 04:06 AM.

  2. #2
    Samit Chakraborty
    Join Date
    Feb 2012
    Posts
    11
    Points
    0
    Answers Provided
    0


    0

    Default Re: Bug: For services added programmatically, ID is not displayed in Map Contents

    This fixed the problem!

    layer.SetValue(MapApplication.LayerNameProperty, layer.ID);

  3. #3
    Julian Starke
    Join Date
    Sep 2011
    Posts
    6
    Points
    1
    Answers Provided
    0


    0

    Default Re: For services added programmatically, ID is not displayed in Map Contents

    Wehre did you add your fixed line of code? Or which line did you replace?

    I have not the same, but a simmiliar problem trying to add WMS-Layers. But at my side there is displayed just nothing in the Map-Contents.

  4. #4
    Samit Chakraborty
    Join Date
    Feb 2012
    Posts
    11
    Points
    0
    Answers Provided
    0


    0

    Default Re: For services added programmatically, ID is not displayed in Map Contents

    Add that line before MapApplication.Current.Map.Layers.Add(layer);
    In my code specifically, it was done at 3 places.
    Hope that helps!

    Regards,
    Samit Chakraborty

  5. #5
    Katherine Dalton

    Join Date
    Jan 2010
    Posts
    299
    Points
    173
    Answers Provided
    22


    0

    Default Re: For services added programmatically, ID is not displayed in Map Contents

    Re:WMSLayer question - Chiming in here to add that you may instead want to use MapApplication.SetLayerName(wmsLayer, layerName);. If you use wmsLayer.SetValue(MapApplication.LayerNameProperty, layerName);, you'll need to explicitly set the wmsLayer.ID property. You can actually use MapApplication.SetLayerName(wmsLayer, layerName); for any layer, though.

    Katy
    Katy Dalton
    Esri Product Engineer

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts