<?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: How to access the featurelayer with sublayer in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105760#M7154</link>
    <description>&lt;P&gt;Hi Ting,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to convert the AGSArcGISMapImageSublayer to AGSFeatureLayer? I need to do the show the popup for the featurelayers also?&lt;/P&gt;</description>
    <pubDate>Fri, 08 Oct 2021 00:13:08 GMT</pubDate>
    <dc:creator>RaymondLi</dc:creator>
    <dc:date>2021-10-08T00:13:08Z</dc:date>
    <item>
      <title>How to access the featurelayer with sublayer</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105645#M7147</link>
      <description>&lt;P&gt;I have the webmap layers as below&lt;/P&gt;&lt;H4&gt;Layers&lt;/H4&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;A href="https://www.company.com/server/rest/services/PublicSafety/ICApp_CIDS2/MapServer/36" target="_blank" rel="noopener"&gt;Train Stations&lt;/A&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;A href="https://www.company.com/server/rest/services/PublicSafety/ICApp_CIDS2/MapServer/35" target="_blank" rel="noopener"&gt;Subway Station&lt;/A&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;A href="https://www.company.com/server/rest/services/PublicSafety/ICApp_CIDS2/MapServer/47" target="_blank" rel="noopener"&gt;Bridges&lt;/A&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;A href="https://www.company.comserver/rest/services/PublicSafety/ICApp_CIDS2/MapServer/53" target="_blank" rel="noopener"&gt;Building with Attachments&lt;/A&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;A href="https://www.company.com/portal/home/item.html?id=9e1caaa976f54063a7f954d10327ce7e" target="_blank" rel="noopener"&gt;Map Layers&lt;/A&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;Hospitals&lt;/LI&gt;&lt;LI&gt;School&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In the swift, I am able to access the first four layer, but I don't know how to access the Hospitals and School. My code as below&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;self.featureLayer = map.operationalLayers.firstObject as? AGSFeatureLayer
for layer in map.operationalLayers {
   if let fLayer = layer as? AGSFeatureLayer {
      print(fLayer.name)
   }else{
      if let subItems = layer as? AGSArcGISMapImageLayer{
         print(subItems.name)

      }else{
         print(layer)
      }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to I access those sublayer feature in swift&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 23:39:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105645#M7147</guid>
      <dc:creator>RaymondLi</dc:creator>
      <dc:date>2021-10-07T23:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the featurelayer with sublayer</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105733#M7150</link>
      <description>&lt;P&gt;Hi Raymond,&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;There doesn't seem to be a &lt;STRONG&gt;School&lt;/STRONG&gt; layer on your service&lt;/LI&gt;&lt;/UL&gt;&lt;P data-unlink="true"&gt;Browsing through the service&amp;nbsp;you provided, I don't see a layer named &lt;STRONG&gt;School&lt;/STRONG&gt;. Hence I'll only use the &lt;STRONG&gt;Hospitals&lt;/STRONG&gt; sublayer, under &lt;STRONG&gt;EMS&lt;/STRONG&gt; group layer as an example.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;About sublayers&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;You can refer to the&amp;nbsp;&lt;A title="sample" href="https://github.com/Esri/arcgis-runtime-samples-ios/tree/main/arcgis-ios-sdk-samples/Layers/Change%20sublayer%20visibility" target="_self"&gt;Change sublayer visibility&lt;/A&gt;&amp;nbsp;sample and other related ones in the iOS Sample Viewer repo to see how sublayer works.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Here is a snippet to show the&amp;nbsp;&lt;STRONG&gt;Hospitals&lt;/STRONG&gt; sublayer from your service&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;You can get to the&amp;nbsp;&lt;STRONG&gt;Hospitals&lt;/STRONG&gt;&amp;nbsp;sublayer from the top level layer, by filtering layer ID, name, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;let portal = AGSPortal(url: URL(string: "https://company.org/portal")!, loginRequired: false)
let portalItem = AGSPortalItem(portal: portal, itemID: "9e1caaa976f54063a7f954d10327ce7e")
let topLayer = AGSArcGISMapImageLayer(item: portalItem)
topLayer.load { [self] _ in
    let sublayers = topLayer.mapImageSublayers as! [AGSArcGISMapImageSublayer]
    let emsLayer = sublayers.first { $0.name == "EMS" }!
    let hospitalsLayer = (emsLayer.subLayerContents as! [AGSArcGISMapImageSublayer]).first { $0.name == "Hospitals" }
    sublayers.forEach { $0.isVisible = false }
    emsLayer.isVisible = true
    emsLayer.subLayerContents.forEach { $0.isVisible = false }
    hospitalsLayer?.isVisible = true
    map.operationalLayers.add(topLayer)
    if let extent = topLayer.fullExtent {
        mapView.setViewpoint(AGSViewpoint(targetExtent: extent))
        mapView.setViewpointScale(3.5e4)
    }
    print(emsLayer.subLayerContents.map(\.name))
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And below is a screenshot for the snippet above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hospitals.png" style="width: 462px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24794i67FC673D8254F5C5/image-size/large?v=v2&amp;amp;px=999" role="button" title="hospitals.png" alt="hospitals.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Here is another snippet to access the&amp;nbsp;&lt;STRONG&gt;Hospitals&amp;nbsp;&lt;/STRONG&gt;layer as a feature layer&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Alternatively, if you don't want to deal with the hassle of managing sublayers, and only want to display the hospital feature layer itself, here is another snippet. By creating a feature layer directly from its underlying table's URL, you can add it&amp;nbsp;separately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;let featureLayer = AGSFeatureLayer(featureTable: AGSServiceFeatureTable(url: URL(string: "https://company.org/server/rest/services/some/MapServer/2")!))
featureLayer.load { [self] error in
    map.operationalLayers.add(featureLayer)
    if let extent = featureLayer.fullExtent {
        mapView.setViewpoint(AGSViewpoint(targetExtent: extent))
        mapView.setViewpointScale(3.5e4)
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp;Please be aware...&lt;/LI&gt;&lt;/UL&gt;&lt;P data-unlink="true"&gt;The layer has minScale set to 35,000. You'll need to zoom in to see its symbology.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps! Please let me know if you have other questions.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 23:45:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105733#M7150</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2021-10-07T23:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the featurelayer with sublayer</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105748#M7152</link>
      <description>&lt;P&gt;Do you mind to remove the host name on your post since it is not suppose here&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 23:41:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105748#M7152</guid>
      <dc:creator>RaymondLi</dc:creator>
      <dc:date>2021-10-07T23:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the featurelayer with sublayer</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105752#M7153</link>
      <description>&lt;P&gt;Yup removed.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 23:46:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105752#M7153</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2021-10-07T23:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the featurelayer with sublayer</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105760#M7154</link>
      <description>&lt;P&gt;Hi Ting,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to convert the AGSArcGISMapImageSublayer to AGSFeatureLayer? I need to do the show the popup for the featurelayers also?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 00:13:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1105760#M7154</guid>
      <dc:creator>RaymondLi</dc:creator>
      <dc:date>2021-10-08T00:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the featurelayer with sublayer</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1109045#M7180</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;Is it possible to convert the AGSArcGISMapImageSublayer to AGSFeatureLayer?&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;No it is not possible. Image layers, as its name indicates, are images rendered by the map server and transferred to the client app. They are read-only and better suitable for displaying purposes. You'll need to create each feature layer from their service feature table in order to work with the features.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please let me know if you have other questions.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 23:06:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/how-to-access-the-featurelayer-with-sublayer/m-p/1109045#M7180</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2021-10-19T23:06:02Z</dc:date>
    </item>
  </channel>
</rss>

