<?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 Feature Layer clone_items issue with multiScaleGeometry? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/feature-layer-clone-items-issue-with/m-p/1418549#M9976</link>
    <description>&lt;P&gt;I've been tasked with cloning some items from one AGO to another AGO, and running into an issue, seemingly from features that have multiScaleGeometryInfo: True&lt;/P&gt;&lt;P&gt;I'm getting the IDs from the source AGO, passing them to the clone_items function&lt;/P&gt;&lt;P&gt;cloned_list = target_gis.content.clone_items(items=[source_item],folder="New Folder",search_existing_items=True)&lt;/P&gt;&lt;P&gt;After a lot of debugging, it seems that Feature Layers with no multiScaleGeometry will clone fine, but if they do have it, I get an error.&lt;/P&gt;&lt;P&gt;Has anyone encountered this, or this error before?&lt;/P&gt;&lt;P&gt;('Failed to create Feature Service FEAUTRE_LAYER: list index out of range', &amp;lt;Item title:"FEAUTRE_LAYER" type:Feature Layer Collection owner:newowner&amp;gt;)&lt;/P&gt;&lt;P&gt;I had help tracing this error down to the _clone.py script, line 2753 "layers[layer_id].container.manager.layers[layer_id].update_definition.&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the debugger running, the layer_id showed 156 when hovering over it (which was the correct layer ID from the service) but in the variables window, it showed that 0.&amp;nbsp; So it seems like that is the issue?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/102959i4C01B55F4F91922C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fullerror.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/102960i62444B3F1EBD8CAA/image-size/large?v=v2&amp;amp;px=999" role="button" title="fullerror.JPG" alt="fullerror.JPG" /&gt;&lt;/span&gt;Not entirely sure how to go about fixing that.&lt;/P&gt;</description>
    <pubDate>Fri, 03 May 2024 04:39:02 GMT</pubDate>
    <dc:creator>anotgrass_007</dc:creator>
    <dc:date>2024-05-03T04:39:02Z</dc:date>
    <item>
      <title>Feature Layer clone_items issue with multiScaleGeometry?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/feature-layer-clone-items-issue-with/m-p/1418549#M9976</link>
      <description>&lt;P&gt;I've been tasked with cloning some items from one AGO to another AGO, and running into an issue, seemingly from features that have multiScaleGeometryInfo: True&lt;/P&gt;&lt;P&gt;I'm getting the IDs from the source AGO, passing them to the clone_items function&lt;/P&gt;&lt;P&gt;cloned_list = target_gis.content.clone_items(items=[source_item],folder="New Folder",search_existing_items=True)&lt;/P&gt;&lt;P&gt;After a lot of debugging, it seems that Feature Layers with no multiScaleGeometry will clone fine, but if they do have it, I get an error.&lt;/P&gt;&lt;P&gt;Has anyone encountered this, or this error before?&lt;/P&gt;&lt;P&gt;('Failed to create Feature Service FEAUTRE_LAYER: list index out of range', &amp;lt;Item title:"FEAUTRE_LAYER" type:Feature Layer Collection owner:newowner&amp;gt;)&lt;/P&gt;&lt;P&gt;I had help tracing this error down to the _clone.py script, line 2753 "layers[layer_id].container.manager.layers[layer_id].update_definition.&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the debugger running, the layer_id showed 156 when hovering over it (which was the correct layer ID from the service) but in the variables window, it showed that 0.&amp;nbsp; So it seems like that is the issue?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/102959i4C01B55F4F91922C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fullerror.JPG" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/102960i62444B3F1EBD8CAA/image-size/large?v=v2&amp;amp;px=999" role="button" title="fullerror.JPG" alt="fullerror.JPG" /&gt;&lt;/span&gt;Not entirely sure how to go about fixing that.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 04:39:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/feature-layer-clone-items-issue-with/m-p/1418549#M9976</guid>
      <dc:creator>anotgrass_007</dc:creator>
      <dc:date>2024-05-03T04:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer clone_items issue with multiScaleGeometry?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/feature-layer-clone-items-issue-with/m-p/1418584#M9977</link>
      <description>&lt;P&gt;As you noted, the problem seems to be with the line "&lt;SPAN&gt;layers[layer_id].container.manager.layers[layer_id].update_definition"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Are there actually 150+ layers in the feature layer collection? the error seems to imply layers is a list and the index value (in this case 156) is out of range&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 10:13:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/feature-layer-clone-items-issue-with/m-p/1418584#M9977</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-05-03T10:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer clone_items issue with multiScaleGeometry?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/feature-layer-clone-items-issue-with/m-p/1418680#M9978</link>
      <description>&lt;P&gt;There is just one layer in the service.&amp;nbsp; I believe the layer was published individually from a Pro project which is why the ID is 156 rather than 0&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 13:13:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/feature-layer-clone-items-issue-with/m-p/1418680#M9978</guid>
      <dc:creator>anotgrass_007</dc:creator>
      <dc:date>2024-05-03T13:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer clone_items issue with multiScaleGeometry?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/feature-layer-clone-items-issue-with/m-p/1431634#M10002</link>
      <description>&lt;P&gt;Okay, so the problem seems to be the logic used to get layer - it doesn't account for the case you mentioned where the id could be higher than the length of the list. I believe this is a valid bug you can log in the repo:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-python-api/issues" target="_blank" rel="noopener"&gt;Issues · Esri/arcgis-python-api · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;To fix this, you might just be able to adjust the for loop to use enumerate.&lt;/P&gt;&lt;P&gt;So, in the source it would change to:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;for&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;index, layer_id&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;in&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;enumerate(layer_ids):&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;And then you would replace the point where it fails with &lt;STRONG&gt;layers[index]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You might need to do that in a few places.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 14:06:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/feature-layer-clone-items-issue-with/m-p/1431634#M10002</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-05-10T14:06:24Z</dc:date>
    </item>
  </channel>
</rss>

