<?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 create_view Does not work if layer ids are not ordered sequentially in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1487873#M10141</link>
    <description>&lt;P&gt;Views created &lt;EM&gt;programmatically&lt;/EM&gt; from services that have non-sequential layer ids are unusable. I created a view from this code:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;source_search = gis.content.search("test_20240608_unique_ids_assigned_all_around")[0]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;source_flc = FeatureLayerCollection.fromitem(source_search)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;new_view = source_flc.manager.create_view(name="unid_all_around_view")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Source-Service layer ids:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGregor1_2-1717940262608.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/106551i03416DFAB96D8AC4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RandyMcGregor1_2-1717940262608.png" alt="RandyMcGregor1_2-1717940262608.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;View layer ids:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGregor1_1-1717940200627.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/106550iE99E4EC1EF794AF1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RandyMcGregor1_1-1717940200627.png" alt="RandyMcGregor1_1-1717940200627.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When the view is opened in the map viewer, the layers are messed up. The Route line layer has become a point layer and one of the point layers (the one with the very long name!) has become a line. A complete mess.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGregor1_0-1717940084014.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/106549iA83D0B675F0E8997/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RandyMcGregor1_0-1717940084014.png" alt="RandyMcGregor1_0-1717940084014.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This happens consistently, on more than one platform. It does not happen when views are created manually. Also, create_view works fine when the layers are ordered sequentially 0 to N, top-down.&lt;/P&gt;</description>
    <pubDate>Sun, 09 Jun 2024 13:47:04 GMT</pubDate>
    <dc:creator>RandyMcGregor_Home</dc:creator>
    <dc:date>2024-06-09T13:47:04Z</dc:date>
    <item>
      <title>create_view Does not work if layer ids are not ordered sequentially</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1487873#M10141</link>
      <description>&lt;P&gt;Views created &lt;EM&gt;programmatically&lt;/EM&gt; from services that have non-sequential layer ids are unusable. I created a view from this code:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;source_search = gis.content.search("test_20240608_unique_ids_assigned_all_around")[0]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;source_flc = FeatureLayerCollection.fromitem(source_search)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;new_view = source_flc.manager.create_view(name="unid_all_around_view")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Source-Service layer ids:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGregor1_2-1717940262608.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/106551i03416DFAB96D8AC4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RandyMcGregor1_2-1717940262608.png" alt="RandyMcGregor1_2-1717940262608.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;View layer ids:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGregor1_1-1717940200627.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/106550iE99E4EC1EF794AF1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RandyMcGregor1_1-1717940200627.png" alt="RandyMcGregor1_1-1717940200627.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When the view is opened in the map viewer, the layers are messed up. The Route line layer has become a point layer and one of the point layers (the one with the very long name!) has become a line. A complete mess.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RandyMcGregor1_0-1717940084014.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/106549iA83D0B675F0E8997/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RandyMcGregor1_0-1717940084014.png" alt="RandyMcGregor1_0-1717940084014.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This happens consistently, on more than one platform. It does not happen when views are created manually. Also, create_view works fine when the layers are ordered sequentially 0 to N, top-down.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2024 13:47:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1487873#M10141</guid>
      <dc:creator>RandyMcGregor_Home</dc:creator>
      <dc:date>2024-06-09T13:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: create_view Does not work if layer ids are not ordered sequentially</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1488294#M10148</link>
      <description>&lt;P&gt;I've experienced this issue. I believe it is a defect that Esri should correct: create_view fails to index the layers sequentially.&lt;/P&gt;&lt;P&gt;I see you commented on my other thread.&lt;/P&gt;&lt;P&gt;Meanwhile, the workaround is to manually zero-based index the layers in the hosted feature layer using&amp;nbsp;&lt;A href="https://ago-assistant.esri.com/" target="_self"&gt;https://ago-assistant.esri.com/&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dirk_Vandervoort_0-1718032592182.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/106629iE8BCEEDBEF66546E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Dirk_Vandervoort_0-1718032592182.png" alt="Dirk_Vandervoort_0-1718032592182.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm working on a solution in Python but haven't gotten there yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 15:19:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1488294#M10148</guid>
      <dc:creator>Dirk_Vandervoort</dc:creator>
      <dc:date>2024-06-10T15:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: create_view Does not work if layer ids are not ordered sequentially</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1488589#M10155</link>
      <description>&lt;P&gt;It's actually a bug, but I can't scare it up at the moment. The status of the bug is 'As-Designed' which I do not understand.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 00:12:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1488589#M10155</guid>
      <dc:creator>RandyMcGregor_Home</dc:creator>
      <dc:date>2024-06-11T00:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: create_view Does not work if layer ids are not ordered sequentially</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1488590#M10156</link>
      <description>&lt;P&gt;The 'workaround' offered by the bug-description, is to create the view manually in AGOL.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 00:12:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1488590#M10156</guid>
      <dc:creator>RandyMcGregor_Home</dc:creator>
      <dc:date>2024-06-11T00:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: create_view Does not work if layer ids are not ordered sequentially</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1491488#M10178</link>
      <description>&lt;P&gt;Thanks. I'll check that out. There is a 'preserve_layer_ids' property in the create_view method, but I haven't gotten it to accept True&lt;/P&gt;&lt;P&gt;create_view(name = viewName, preserve_layer_ids = True) throws an error. Replace &lt;EM&gt;True&lt;/EM&gt; with &lt;EM&gt;Fals&lt;/EM&gt;e and it works but that's the default and not what I want for this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 10:50:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1491488#M10178</guid>
      <dc:creator>RandyMcGregor_Home</dc:creator>
      <dc:date>2024-06-13T10:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: create_view Does not work if layer ids are not ordered sequentially</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1587966#M11173</link>
      <description>&lt;P&gt;Putting preserve_layer_ids to False solved it for me. The layer ids are not that important I guess because they're not hard-coded in my scripts, just my memory!&lt;BR /&gt;I'll have to change that! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 14:43:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1587966#M11173</guid>
      <dc:creator>mikaël</dc:creator>
      <dc:date>2025-02-21T14:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: create_view Does not work if layer ids are not ordered sequentially</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1588118#M11177</link>
      <description>&lt;P&gt;As an alternative&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/324146"&gt;@RandyMcGregor_Home&lt;/a&gt;, you could always create your view by calling create_service(is_view=True) and then add_to_definition() to populate it.&lt;/P&gt;&lt;P&gt;It's what AGOL does when you create a view through the web page and it's what I've been doing because create_view() wasn't working for me.&lt;BR /&gt;I can share my code if it's something that interests you.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 18:14:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-view-does-not-work-if-layer-ids-are-not/m-p/1588118#M11177</guid>
      <dc:creator>mikaël</dc:creator>
      <dc:date>2025-02-21T18:14:15Z</dc:date>
    </item>
  </channel>
</rss>

