<?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: Enumerate Layers in Map Package in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/enumerate-layers-in-map-package/m-p/649071#M8102</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark -&lt;/P&gt;&lt;P&gt;Once you have a layer from the local service, you can use the ServiceInfo property of the layer to get details about the service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following example creates a dynamic map service layer using the URL of the local service. It then reads the service info and loops thru all layers in the service to find layer ID and name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; localService &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;LocalFeatureService&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;Await&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;LocalFeatureService&lt;/SPAN&gt;.StartAsync(mpkPath)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; dynLayer &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;ArcGISDynamicMapServiceLayer&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;New&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;ArcGISDynamicMapServiceLayer&lt;/SPAN&gt;(&lt;SPAN style="color: #569cd6;"&gt;New&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;Uri&lt;/SPAN&gt;(localService.UrlMapService))&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Await&lt;/SPAN&gt; dynLayer.InitializeAsync()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; serviceInfo &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;MapServiceInfo&lt;/SPAN&gt; = dynLayer.ServiceInfo&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; layerInfo &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;IReadOnlyCollection&lt;/SPAN&gt;(&lt;SPAN style="color: #569cd6;"&gt;Of&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;LayerServiceInfo&lt;/SPAN&gt;) = serviceInfo.Layers&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;Each&lt;/SPAN&gt; info &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;LayerServiceInfo&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;In&lt;/SPAN&gt; layerInfo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; id &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;Integer&lt;/SPAN&gt; = info.ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; name &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;String&lt;/SPAN&gt; = info.Name&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Next&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;You could do the same thing with ServiceFeatureTable (sfTable variable in your example) - initialize a service feature table with the first table in the package, then read the service info to determine what else is available.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps, Thad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Feb 2015 00:12:27 GMT</pubDate>
    <dc:creator>ThadTilton</dc:creator>
    <dc:date>2015-02-03T00:12:27Z</dc:date>
    <item>
      <title>Enumerate Layers in Map Package</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/enumerate-layers-in-map-package/m-p/649070#M8101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="text-align: left;"&gt;What is the proper way to enumerate layers in MPK package generate from a personal geodatabase without using a MapView control?&amp;nbsp; All the examples use the MapView or hard-code an index of the layer needed.&amp;nbsp; Here is code (VB.NET):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Dim map As Esri.ArcGISRuntime.LocalServices.LocalFeatureService = _
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Await Esri.ArcGISRuntime.LocalServices.LocalFeatureService.StartAsync(mpkPath)
Dim i As Integer = 0
Do While True
&amp;nbsp; Dim sfTable As Esri.ArcGISRuntime.Data.ServiceFeatureTable = Nothing
&amp;nbsp; Try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sfTable = Await Esri.ArcGISRuntime.Data.ServiceFeatureTable.OpenAsync(New Uri(map.UrlMapService &amp;amp; "/" &amp;amp; i))
&amp;nbsp; Catch ex As Exception
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sfTable = Nothing
&amp;nbsp; End Try
&amp;nbsp; If sfTable Is Nothing Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Do
&amp;nbsp; End If
&amp;nbsp; ' Do something with sfTable
&amp;nbsp; i += 1
Loop&lt;/PRE&gt;&lt;P&gt;Is this the proper way of enumerating until you get a 404 error when you're passed the last index ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Mark Oberg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:31:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/enumerate-layers-in-map-package/m-p/649070#M8101</guid>
      <dc:creator>MarkOberg</dc:creator>
      <dc:date>2021-12-12T03:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Enumerate Layers in Map Package</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/enumerate-layers-in-map-package/m-p/649071#M8102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark -&lt;/P&gt;&lt;P&gt;Once you have a layer from the local service, you can use the ServiceInfo property of the layer to get details about the service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following example creates a dynamic map service layer using the URL of the local service. It then reads the service info and loops thru all layers in the service to find layer ID and name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; localService &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;LocalFeatureService&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;Await&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;LocalFeatureService&lt;/SPAN&gt;.StartAsync(mpkPath)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; dynLayer &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;ArcGISDynamicMapServiceLayer&lt;/SPAN&gt; = &lt;SPAN style="color: #569cd6;"&gt;New&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;ArcGISDynamicMapServiceLayer&lt;/SPAN&gt;(&lt;SPAN style="color: #569cd6;"&gt;New&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;Uri&lt;/SPAN&gt;(localService.UrlMapService))&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Await&lt;/SPAN&gt; dynLayer.InitializeAsync()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; serviceInfo &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;MapServiceInfo&lt;/SPAN&gt; = dynLayer.ServiceInfo&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; layerInfo &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;IReadOnlyCollection&lt;/SPAN&gt;(&lt;SPAN style="color: #569cd6;"&gt;Of&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;LayerServiceInfo&lt;/SPAN&gt;) = serviceInfo.Layers&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;Each&lt;/SPAN&gt; info &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #4ec9b0;"&gt;LayerServiceInfo&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;In&lt;/SPAN&gt; layerInfo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; id &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;Integer&lt;/SPAN&gt; = info.ID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #569cd6;"&gt;Dim&lt;/SPAN&gt; name &lt;SPAN style="color: #569cd6;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #569cd6;"&gt;String&lt;/SPAN&gt; = info.Name&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #569cd6;"&gt;Next&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303030;"&gt;You could do the same thing with ServiceFeatureTable (sfTable variable in your example) - initialize a service feature table with the first table in the package, then read the service info to determine what else is available.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps, Thad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 00:12:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/enumerate-layers-in-map-package/m-p/649071#M8102</guid>
      <dc:creator>ThadTilton</dc:creator>
      <dc:date>2015-02-03T00:12:27Z</dc:date>
    </item>
  </channel>
</rss>

