<?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: Assign Layer IDs using ArcPy in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1363112#M9442</link>
    <description>&lt;P&gt;I think this might be the only way to do it, but be careful using the CIM and be sure you know what you are doing. If you are on ArcGIS Pro 3.X, you use "V3" instead of "V2". If you export a layer to a layer file (.lyrx) and open in a notepad you can get a better understanding of the CIM. I recommend using Notepad ++ and changing the language to JSON for readability with syntax highlighting.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Dec 2023 08:53:26 GMT</pubDate>
    <dc:creator>Clubdebambos</dc:creator>
    <dc:date>2023-12-21T08:53:26Z</dc:date>
    <item>
      <title>Assign Layer IDs using ArcPy</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1362779#M9437</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm using a python toolbox to process some data and create a map. I'll be using this map to overwrite an AGOL web layer.&lt;/P&gt;&lt;P&gt;I want to make sure that the layer IDs will be the same as in the hosted feature layer. In ArcGIS Pro, I would click the "Allow assignment of unique numeric IDs..." property of the map and then edit the Layer ID property of each layer.&lt;/P&gt;&lt;P&gt;I can see no way to accomplish this using arcpy. The map object doesn't seem to have an "Allow assignment" property and it is not a parameter of the createMap function I used to create the map. Layers also do not seem to have an ID property.&lt;/P&gt;&lt;P&gt;Does anyone know how to do this without user interaction?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Jill&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2023 20:01:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1362779#M9437</guid>
      <dc:creator>JillianStanford</dc:creator>
      <dc:date>2023-12-19T20:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Layer IDs using ArcPy</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1362940#M9438</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;with Python CIM acces you can edit Layer ID in your script (&lt;A href="https://pro.arcgis.com/en/pro-app/3.1/arcpy/mapping/python-cim-access.htm" target="_blank"&gt;Python CIM access—ArcGIS Pro | Documentation&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;me i use it to assign Layer ID before publish like this :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
aprx = arcpy.mp.ArcGISProject('current')
mp = aprx.listMaps('Name of the map')[0]
i = 10
for lyr in mp.listLayers():
    print (lyr.name)
    l_cim = lyr.getDefinition('V2')
    l_cim.serviceLayerID = i
    lyr.setDefinition(l_cim)
    print ("new ID ---&amp;gt; " + str(l_cim.serviceLayerID))
    i += 10&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 07:25:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1362940#M9438</guid>
      <dc:creator>victorCanut</dc:creator>
      <dc:date>2023-12-20T07:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Layer IDs using ArcPy</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1363112#M9442</link>
      <description>&lt;P&gt;I think this might be the only way to do it, but be careful using the CIM and be sure you know what you are doing. If you are on ArcGIS Pro 3.X, you use "V3" instead of "V2". If you export a layer to a layer file (.lyrx) and open in a notepad you can get a better understanding of the CIM. I recommend using Notepad ++ and changing the language to JSON for readability with syntax highlighting.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 08:53:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1363112#M9442</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2023-12-21T08:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Layer IDs using ArcPy</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1363622#M9449</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/204069"&gt;@victorCanut&lt;/a&gt; and &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/417766"&gt;@Clubdebambos&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That was exactly what I was looking for and I was not familiar with the CIM.&lt;/P&gt;&lt;P&gt;FYI, if it could help someone else, to enable the "Allow assignment of unique numeric IDs..." option I used the following:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;map = aprx.createMap("MapName") 
m_cim = map.getDefinition('V3')
m_cim.useServiceLayerIDs = True
map.setDefinition(m_cim)&lt;/LI-CODE&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;Jill&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 15:52:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1363622#M9449</guid>
      <dc:creator>JillianStanford</dc:creator>
      <dc:date>2023-12-21T15:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Layer IDs using ArcPy</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1568413#M10964</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/417766"&gt;@Clubdebambos&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I saw your nice article here, which adds the aprx.save():&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.finaldraftmapping.com/using-arcpy-to-allow-assignment-of-unique-numeric-ids-for-sharing-web-layers-in-arcgis-pro/" target="_blank"&gt;https://learn.finaldraftmapping.com/using-arcpy-to-allow-assignment-of-unique-numeric-ids-for-sharing-web-layers-in-arcgis-pro/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 14:28:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/assign-layer-ids-using-arcpy/m-p/1568413#M10964</guid>
      <dc:creator>AndresCastillo</dc:creator>
      <dc:date>2024-12-13T14:28:40Z</dc:date>
    </item>
  </channel>
</rss>

