<?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 to remove a character from Drawing order layer name using arcpy? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314588#M71645</link>
    <description>&lt;P&gt;lyr is a Layer class, need to grab the layer name from it as string.&amp;nbsp; Think this is what you are looking for:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;for lyr in layer:
    string = lyr.name[1:]&lt;/LI-CODE&gt;&lt;P&gt;Though, you will still get an error if you try to save them with a name starting with a number in a geodatabase.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
    <pubDate>Wed, 02 Aug 2023 14:56:00 GMT</pubDate>
    <dc:creator>RichlandGIS</dc:creator>
    <dc:date>2023-08-02T14:56:00Z</dc:date>
    <item>
      <title>How to remove a character from Drawing order layer name using arcpy?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314143#M71598</link>
      <description>&lt;P&gt;I have a script that creates a geodatabase and then splits a layer by its name into that geodatabase. The problem is if the layer name starts with a number "123" it'll add a "t" to the beginning of the layer name. How do I strip the "t" from the drawing order using arcpy?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 16:34:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314143#M71598</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-08-01T16:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a character from Drawing order layer name using arcpy?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314273#M71616</link>
      <description>&lt;P&gt;That is probably because you are not allowed to have geodatabase&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/defining-feature-class-properties.htm#:~:text=Feature%20class%20names%20must%20be,feature%20datasets%2C%20is%20not%20allowed." target="_self"&gt; feature class name starting with a number&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 19:44:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314273#M71616</guid>
      <dc:creator>RichlandGIS</dc:creator>
      <dc:date>2023-08-01T19:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a character from Drawing order layer name using arcpy?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314512#M71640</link>
      <description>&lt;P&gt;Not exactly sure what you're trying to do, but to get rid of a leading t in python:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;string = "t123abc"&lt;/P&gt;&lt;P&gt;newstring = string[1:]&amp;nbsp; //newstring will be everything but the first character of the original string&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 13:32:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314512#M71640</guid>
      <dc:creator>AngelaSchirck</dc:creator>
      <dc:date>2023-08-02T13:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a character from Drawing order layer name using arcpy?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314578#M71642</link>
      <description>&lt;P&gt;Here's a snippet of a portion of the output. Since the layer starts with a number, arc adds a "T". I'm trying to script removal of all the "T's" since it can be tedious manually removing all of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DELETE.png" style="width: 441px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/77091i1BB17B77A768CE2D/image-size/large?v=v2&amp;amp;px=999" role="button" title="DELETE.png" alt="DELETE.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;import arcpy
Map_name = map1
aprx = arcpy.mp.ArcGISProject("CURRENT")
act_map = aprx.activeMap
map = aprx.listMaps(Map_name)
layer = act_map.listLayers()
for lyr in layer:
    string = lyr[1:]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "&amp;lt;string&amp;gt;", line 8, in &amp;lt;module&amp;gt;&lt;BR /&gt;TypeError: 'Layer' object is not subscriptable&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 14:37:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314578#M71642</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-08-02T14:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a character from Drawing order layer name using arcpy?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314588#M71645</link>
      <description>&lt;P&gt;lyr is a Layer class, need to grab the layer name from it as string.&amp;nbsp; Think this is what you are looking for:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;for lyr in layer:
    string = lyr.name[1:]&lt;/LI-CODE&gt;&lt;P&gt;Though, you will still get an error if you try to save them with a name starting with a number in a geodatabase.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 14:56:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314588#M71645</guid>
      <dc:creator>RichlandGIS</dc:creator>
      <dc:date>2023-08-02T14:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a character from Drawing order layer name using arcpy?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314602#M71646</link>
      <description>&lt;P&gt;I see what you're saying. I found this from stack exchange and it'll strip the first character from Layer names if they don't have a number as their second character.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;fcs = arcpy.ListFeatureClasses()
for fc in fcs:
    Arcpy.Rename_management(fc,fc[1:])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try it with a T123... I get&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 000354: The name contains invalid characters&lt;BR /&gt;Failed to execute (Rename).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm assuming there isn't going to be a way around this?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 15:12:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314602#M71646</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-08-02T15:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a character from Drawing order layer name using arcpy?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314621#M71650</link>
      <description>&lt;P&gt;Unless you want to export them to shapefiles (which do allow filenames to start with numbers) you will run into that error.&lt;/P&gt;&lt;P&gt;You could use something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;string = '_' + lyr.name[1:]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which would replace the 't' with and underscore which will allow you to save them in geodatabase.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 15:41:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314621#M71650</guid>
      <dc:creator>RichlandGIS</dc:creator>
      <dc:date>2023-08-02T15:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove a character from Drawing order layer name using arcpy?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314631#M71652</link>
      <description>&lt;P&gt;Thats how I'll have to do it. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2023 15:44:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-remove-a-character-from-drawing-order-layer/m-p/1314631#M71652</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-08-02T15:44:45Z</dc:date>
    </item>
  </channel>
</rss>

