<?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 do I check if a layer already exists on the Map in ArcGIS Pro using ArcPy? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560913#M43890</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/functions/exists.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/functions/exists.htm"&gt;Exists—ArcPy Functions | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;arcpy.Exists(…) I would think would do it, but you will need to provide the path&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Apr 2019 11:47:21 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2019-04-24T11:47:21Z</dc:date>
    <item>
      <title>How do I check if a layer already exists on the Map in ArcGIS Pro using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560912#M43889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a process that adds a layer from a lyrx file to a group layer on the map. I need to add something into my script to check to see if it already exists so it doesn't add it again but I'm struggling to find anything online about this for ArcGIS Pro. Here's what I currently have (sorry I'm new at this):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;LyrDir &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\\mydir\\"&lt;/SPAN&gt;
off_pk &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Offline group layer\\"&lt;/SPAN&gt;
aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
aprxMap &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Map"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
offGrp &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprxMap&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Offline group layer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

my_lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;LayerFile&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;LyrDir &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"myfile.lyrx"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
 aprxMap&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addLayerToGroup&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;offGrp&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;my_lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
 offlyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprxMap&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;off_pk &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"my layer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; layer &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; offlyr&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visible &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping it would be as simple as typing something like:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;exists&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mylayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   aprxMap&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addLayerToGroup&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;offGrp&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;my_lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
   offlyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprxMap&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;off_pk &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"my layer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
   &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; layer &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; offlyr&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
      layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visible &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If anyone can help, thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:12:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560912#M43889</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T00:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a layer already exists on the Map in ArcGIS Pro using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560913#M43890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/functions/exists.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/functions/exists.htm"&gt;Exists—ArcPy Functions | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;arcpy.Exists(…) I would think would do it, but you will need to provide the path&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2019 11:47:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560913#M43890</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-04-24T11:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a layer already exists on the Map in ArcGIS Pro using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560914#M43891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the help Dan. That gets me part of the way there. It returns 'True' if I check a layer exists outside of a group layer but when I try to find my layer 'my group\my layer' it always returns 'False' even though it exists. I'm assuming it requires a slightly different process if something is nested. Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2019 08:42:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560914#M43891</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-04-26T08:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a layer already exists on the Map in ArcGIS Pro using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560915#M43892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;sounds like you have to check to see if the layer is a group layer or check each layers 'longName' property to get the full path to it&lt;/P&gt;&lt;TABLE style="background-color: #ffffff; border-collapse: collapse; border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-spacing: 0px; color: #4c4c4c; font-family: &amp;amp;quot; avenir next w01&amp;amp;quot;,&amp;amp;quot;avenir next w00&amp;amp;quot;,&amp;amp;quot;avenir next&amp;amp;quot;,&amp;amp;quot;avenir&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,sans-serif; font-size: 0.87rem; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 1.55rem; margin-bottom: 1.55rem; orphans: 2; overflow: auto; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; width: 100%; word-spacing: 0px; border: 1px solid #cccccc;"&gt;&lt;TBODY style="overflow: auto; width: 100%;"&gt;&lt;TR style="border-bottom-color: #cccccc; border-bottom-style: solid; border-bottom-width: 1px; text-align: left;"&gt;&lt;TD style="border-left-color: #cccccc; border-left-style: solid; border-left-width: 1px; border-right-color: #cccccc; border-right-style: solid; border-right-width: 1px; font-weight: 300; padding: 0.51rem;"&gt;longName&lt;DIV&gt;(Read Only)&lt;/DIV&gt;&lt;/TD&gt;&lt;TD style="border-left-color: #cccccc; border-left-style: solid; border-left-width: 1px; border-right-color: #cccccc; border-right-style: solid; border-right-width: 1px; font-weight: 300; padding: 0.51rem;"&gt;&lt;P style="margin-bottom: 0px; margin-top: 0px;"&gt;A layer's full path including group layer folder structure.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="color: #3d3d3d; font-family: Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; overflow-wrap: break-word; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; padding: 0px; margin: 0px;"&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/layer-class.htm" style="color: #2989c5; text-decoration: none;" title="https://pro.arcgis.com/en/pro-app/arcpy/mapping/layer-class.htm"&gt;Layer—ArcPy | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2019 12:09:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560915#M43892</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-04-26T12:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a layer already exists on the Map in ArcGIS Pro using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560916#M43893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks that's helpful. Unfortunately I' struggling with implementing it. I can't find out to to specify a particular group. I have added the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; aprxMap&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"my layer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;longName&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;longName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I've put print in the third line to see what response I get and it is as expected. The issue is that I have two group layers which have the layer in. I want to specify the offline layer as I'm essentially copying the data from online group layer to the offline one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:12:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560916#M43893</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T00:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a layer already exists on the Map in ArcGIS Pro using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560917#M43894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sounds convoluted, so you seem to be wanting to parse the path as well to find the source group layer, so you can copy (or whatever) to a destination group layer.&amp;nbsp; So the layer name will remain the same, but the long name will differ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2019 14:51:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560917#M43894</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2019-04-26T14:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a layer already exists on the Map in ArcGIS Pro using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560918#M43895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apologies, I'm possibly not explaining this very well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an online version of the feature layer that&amp;nbsp;comes from ArcGIS Online and sits in the group layer 'Online group layer'. I then have an offline version of this layer (a file gdb) which sits locally and exists as a layer in the group layer 'Offline group layer'.&lt;/P&gt;&lt;P&gt;The process previously copied the data from the online layer into the file gdb and worked without anything too complex having to happen however, since version 2.2 of ArcGIS Pro and later, because of a bug which is now known to Esri, the layer based on the gdb is dropped from the map when it's overwritten.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I've had to do is add it back in using a&amp;nbsp;lyrx file after the gdb has been updated. In some situations there is a possibility that the offline&amp;nbsp;version of the layer is not dropped from the map and to ensure it isn't added again I want to do a check to tell it to only add the layer to the 'Offline group layer' on the map from the lyrx file if it doesn't already exist in the offline group layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All names are static so the map contents will always look roughly like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v Map&lt;/P&gt;&lt;P&gt;&amp;nbsp;v Offline group layer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;gt;&amp;nbsp; my layer&lt;/P&gt;&lt;P&gt;&amp;nbsp;v&amp;nbsp;Online group layer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;gt; my layer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the 'my layer' in 'offline group layer' comes from a gdb file/is inserted from a lyrx file and the 'my layer' in 'Online group layer' comes from ArcGIS Online&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Apr 2019 15:18:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/560918#M43895</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-04-26T15:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I check if a layer already exists on the Map in ArcGIS Pro using ArcPy?</title>
      <link>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/1072463#M61491</link>
      <description>&lt;P&gt;I think Dans answer checks for the Feature Class in the geodatabase. To check for the layer in the map use a for loop to iterate through the layers e.g.&lt;BR /&gt;&lt;BR /&gt;currentProject = arcpy.mp.ArcGISProject("CURRENT")&lt;BR /&gt;currentMap = currentProject.listMaps()[0] #I think this assumes there is only one map&lt;BR /&gt;layers = currentMap.listLayers()&lt;BR /&gt;&lt;BR /&gt;for layer in layers:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if layer.name == "Property_LYR":&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #do something with the layer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.management.ApplySymbologyFromLayer(PROPERTY_LYR, PROPERTY_LYRX)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; else:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #do something else&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jun 2021 07:36:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-do-i-check-if-a-layer-already-exists-on-the/m-p/1072463#M61491</guid>
      <dc:creator>LeandraGordon</dc:creator>
      <dc:date>2021-06-25T07:36:06Z</dc:date>
    </item>
  </channel>
</rss>

