<?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 FeatureLayerCollection.manager.create_view creates view with incorrect number of sublayers (ArcGIS Online) in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/featurelayercollection-manager-create-view-creates/m-p/1418860#M9982</link>
    <description>&lt;P&gt;In code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;schema_item = gis.content.get(schema_itemId)

view_layers =[]
a_layer = schema_item.layers[2]
view_layers.append(a_layer)
a_layer = schema_item.layers[5]
view_layers.append(a_layer)
a_layer = schema_item.layers[4]
view_layers.append(a_layer)
a_layer = schema_item.layers[3]
view_layers.append(a_layer)

flc = FeatureLayerCollection.fromitem(schema_item)
view_item = flc.manager.create_view(name=target_view_name, view_layers=view_layers)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A nice simple view with four layers. Clean code.&lt;/P&gt;&lt;P&gt;The results in the ArcGIS Online portal shows 2 layers in the view (WRONG!):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dirk_Vandervoort_0-1714755777079.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103039i1FB5293E580EC809/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dirk_Vandervoort_0-1714755777079.png" alt="Dirk_Vandervoort_0-1714755777079.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The results in the REST catalog shows 4 sublayers (RIGHT!):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dirk_Vandervoort_1-1714755922116.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103040i796EF6C793A45D31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dirk_Vandervoort_1-1714755922116.png" alt="Dirk_Vandervoort_1-1714755922116.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adding the view to ArcGIS Pro shows only 2 sublayers (WRONG):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dirk_Vandervoort_2-1714756177783.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103041i86EF8997035F55BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dirk_Vandervoort_2-1714756177783.png" alt="Dirk_Vandervoort_2-1714756177783.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However I can add the sublayers one-at-a-time by the sublayer path:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dirk_Vandervoort_3-1714756302084.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103043i315DC158B2A55012/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dirk_Vandervoort_3-1714756302084.png" alt="Dirk_Vandervoort_3-1714756302084.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What's going on here? I need all four layers.&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;&lt;P&gt;&amp;lt;EditEdit&amp;gt;&lt;/P&gt;&lt;P&gt;After poking around in the view using&amp;nbsp;&lt;A href="https://ago-assistant.esri.com/" target="_self"&gt;https://ago-assistant.esri.com/&lt;/A&gt;&amp;nbsp;I have identified that the id of the individual layers are oddly ordered - some repeats, some no-existent indexes, etc. If I manually increment the layer ids in the json, all layers are present and properly indexed.&lt;/P&gt;&lt;P&gt;&amp;lt;/EditEdit&amp;gt;&lt;/P&gt;</description>
    <pubDate>Sun, 05 May 2024 16:20:11 GMT</pubDate>
    <dc:creator>Dirk_Vandervoort</dc:creator>
    <dc:date>2024-05-05T16:20:11Z</dc:date>
    <item>
      <title>FeatureLayerCollection.manager.create_view creates view with incorrect number of sublayers (ArcGIS Online)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/featurelayercollection-manager-create-view-creates/m-p/1418860#M9982</link>
      <description>&lt;P&gt;In code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;schema_item = gis.content.get(schema_itemId)

view_layers =[]
a_layer = schema_item.layers[2]
view_layers.append(a_layer)
a_layer = schema_item.layers[5]
view_layers.append(a_layer)
a_layer = schema_item.layers[4]
view_layers.append(a_layer)
a_layer = schema_item.layers[3]
view_layers.append(a_layer)

flc = FeatureLayerCollection.fromitem(schema_item)
view_item = flc.manager.create_view(name=target_view_name, view_layers=view_layers)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A nice simple view with four layers. Clean code.&lt;/P&gt;&lt;P&gt;The results in the ArcGIS Online portal shows 2 layers in the view (WRONG!):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dirk_Vandervoort_0-1714755777079.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103039i1FB5293E580EC809/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dirk_Vandervoort_0-1714755777079.png" alt="Dirk_Vandervoort_0-1714755777079.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The results in the REST catalog shows 4 sublayers (RIGHT!):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dirk_Vandervoort_1-1714755922116.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103040i796EF6C793A45D31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dirk_Vandervoort_1-1714755922116.png" alt="Dirk_Vandervoort_1-1714755922116.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adding the view to ArcGIS Pro shows only 2 sublayers (WRONG):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dirk_Vandervoort_2-1714756177783.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103041i86EF8997035F55BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dirk_Vandervoort_2-1714756177783.png" alt="Dirk_Vandervoort_2-1714756177783.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However I can add the sublayers one-at-a-time by the sublayer path:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dirk_Vandervoort_3-1714756302084.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/103043i315DC158B2A55012/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dirk_Vandervoort_3-1714756302084.png" alt="Dirk_Vandervoort_3-1714756302084.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What's going on here? I need all four layers.&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;&lt;P&gt;&amp;lt;EditEdit&amp;gt;&lt;/P&gt;&lt;P&gt;After poking around in the view using&amp;nbsp;&lt;A href="https://ago-assistant.esri.com/" target="_self"&gt;https://ago-assistant.esri.com/&lt;/A&gt;&amp;nbsp;I have identified that the id of the individual layers are oddly ordered - some repeats, some no-existent indexes, etc. If I manually increment the layer ids in the json, all layers are present and properly indexed.&lt;/P&gt;&lt;P&gt;&amp;lt;/EditEdit&amp;gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2024 16:20:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/featurelayercollection-manager-create-view-creates/m-p/1418860#M9982</guid>
      <dc:creator>Dirk_Vandervoort</dc:creator>
      <dc:date>2024-05-05T16:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayerCollection.manager.create_view creates view with incorrect number of sublayers (ArcGIS Online)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/featurelayercollection-manager-create-view-creates/m-p/1487869#M10140</link>
      <description>&lt;P&gt;I am having a similar problem. If the layer ids in a service are not sequentially ordered, create_view will create a view with messed up layer order.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1487873" target="_blank"&gt;https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1487873&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2024 14:18:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/featurelayercollection-manager-create-view-creates/m-p/1487869#M10140</guid>
      <dc:creator>RandyMcGregor_Home</dc:creator>
      <dc:date>2024-06-09T14:18:58Z</dc:date>
    </item>
  </channel>
</rss>

