<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get Layer type in DynamicMapService in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276443#M7244</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If you just want to check whether a layer is visible or not, you could work with ArcGISDynamicMapServiceLayer's VisibleLayers property. This returns an integer array, cast it to IList and use Contains() method to figure out if a specific layer is visible.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, that is what I am doing now, but what I want to know is that if the layer is visible, what kind of layer it is i.e. Annotation Layer, Feature Layer, Group Layer, etc. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like layerinfo tells if it's visible or not, but doesn't tell what kind of layer it is.&amp;nbsp; It'd be nice to get layer type from layerinfo.&amp;nbsp; Any more pointers?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Sep 2011 14:06:36 GMT</pubDate>
    <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
    <dc:date>2011-09-21T14:06:36Z</dc:date>
    <item>
      <title>Get Layer type in DynamicMapService</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276439#M7240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a way to determine the type of layer(s) in a map service?&amp;nbsp; When looping through all the layers in my map service I would like to know what kind of layers they are.&amp;nbsp; I thought maybe there would be a property in the LayerInfo class but there is not.&amp;nbsp; Any Ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Sep 2011 20:50:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276439#M7240</guid>
      <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
      <dc:date>2011-09-18T20:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get Layer type in DynamicMapService</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276440#M7241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can query the 'layers' resource of the map service and deserialize the response by yourself:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- documentation : &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/layers.html"&gt;&lt;SPAN style="color:#417394;"&gt;http://help.arcgis.com/en/arcgisserv...st/layers.html&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;- sample : &lt;/SPAN&gt;&lt;A href="http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Percent_Over_64/MapServer/layers?f=pjson"&gt;&lt;SPAN style="color:#417394;"&gt;http://services.arcgisonline.com/Arc...layers?f=pjson&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The type field is giving you the type of layer (Feature Layer, Raster, Group Layer, ....)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Sep 2011 06:56:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276440#M7241</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2011-09-19T06:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Get Layer type in DynamicMapService</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276441#M7242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Do you think you could help me along a little more.&amp;nbsp; What I am looking to do is loop through all the layers in my Dynamic Map Service and build a list of layers that are visible. If the Layer is visible and is an annotation sublayer I don't want to add it to my list (since anno sublayers should always be checked/visible).&amp;nbsp; I'm not 100% sure how to query json but that sounds like what I need to do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code as it stands now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; Public Function VisibleLayerList(ByVal MapService As ArcGISDynamicMapServiceLayer) As String
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim LayList As String
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Each ly As LayerInfo In MapService.Layers
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If MapService.GetLayerVisibility(ly.ID) = True Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LayList += (ly.ID) &amp;amp; ","
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If LayList.EndsWith(",") Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LayList = LayList.Substring(0, LayList.Length - 1)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return LayList
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:28:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276441#M7242</guid>
      <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
      <dc:date>2021-12-11T13:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Get Layer type in DynamicMapService</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276442#M7243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you just want to check whether a layer is visible or not, you could work with ArcGISDynamicMapServiceLayer's VisibleLayers property. This returns an integer array, cast it to IList and use Contains() method to figure out if a specific layer is visible.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 12:48:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276442#M7243</guid>
      <dc:creator>GarimaVyas</dc:creator>
      <dc:date>2011-09-20T12:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get Layer type in DynamicMapService</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276443#M7244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If you just want to check whether a layer is visible or not, you could work with ArcGISDynamicMapServiceLayer's VisibleLayers property. This returns an integer array, cast it to IList and use Contains() method to figure out if a specific layer is visible.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, that is what I am doing now, but what I want to know is that if the layer is visible, what kind of layer it is i.e. Annotation Layer, Feature Layer, Group Layer, etc. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like layerinfo tells if it's visible or not, but doesn't tell what kind of layer it is.&amp;nbsp; It'd be nice to get layer type from layerinfo.&amp;nbsp; Any more pointers?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 14:06:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276443#M7244</guid>
      <dc:creator>deleted-user-ATjHIWsdQYmT</dc:creator>
      <dc:date>2011-09-21T14:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Get Layer type in DynamicMapService</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276444#M7245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To get the layer type by quering the 'layers' REST resource.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Get the JsonReader util class I attached&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Define the datacontracts corresponding to the 'layers' end point:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
namespace DataContracts
{
&amp;nbsp; [DataContract]
&amp;nbsp; public class LayersData
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataMember(Name = "layers")]
&amp;nbsp;&amp;nbsp;&amp;nbsp; public IEnumerable&amp;lt;LayerData&amp;gt; Layers { get; set; }
&amp;nbsp; }
 
&amp;nbsp; [DataContract]
&amp;nbsp; public class LayerData // Only data for the sample -&amp;gt; to complete if needed
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataMember(Name = "id")]
&amp;nbsp;&amp;nbsp;&amp;nbsp; public int Id { get; set; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataMember(Name = "type")]
&amp;nbsp;&amp;nbsp;&amp;nbsp; public String Type { get; set; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; [DataMember(Name = "defaultVisibility")]
&amp;nbsp;&amp;nbsp;&amp;nbsp; public bool DefaultVisibility { get; set; }
&amp;nbsp; }
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Get asynchronously the layer infos with code like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
void GetLayersAsync()
{
&amp;nbsp; var json = new JsonReader&amp;lt;LayersData&amp;gt;();
&amp;nbsp; json.OnCompleted += json_OnCompleted;
&amp;nbsp; json.GetData("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/layers?f=json");
}
void json_OnCompleted(object sender, CompletedEventsArg&amp;lt;LayersData&amp;gt; e)
{
&amp;nbsp; var layers = e.Result.Layers;
&amp;nbsp; if (layers != null)
 {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // For sample : create an array with visible layers of type "Feature Layer"
&amp;nbsp;&amp;nbsp;&amp;nbsp; int[] visibleFeatureLayers = layers.Where(layer =&amp;gt; layer.DefaultVisibility &amp;amp;&amp;amp; layer.Type == "Feature Layer").Select(layer =&amp;gt; layer.Id).ToArray();
&amp;nbsp;&amp;nbsp;&amp;nbsp; .........
&amp;nbsp; }
}
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:28:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/get-layer-type-in-dynamicmapservice/m-p/276444#M7245</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-11T13:28:20Z</dc:date>
    </item>
  </channel>
</rss>

