<?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: ArcGIS Split Tool: How to change output name prefix based on polygon attribute in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724680#M56126</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lara, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm guessing you are getting an error because of the search cursor. I think I forgot to finish the code for the search cursor the last time I gave it to you. It should be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;arcpy.da.SearchCursor(Catchment,["OID@","Outlet_ID"],where_clause = '{0} = {1}'.format(arcpy.AddFieldDelimiters(CHM_Input, oidField),&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-weight: bold; font-size: 13px; font-family: inherit; font-style: inherit;"&gt;Raster_Number&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;)).next()[1]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;I'm not sure why you are getting a "\\Service" tagged to your output name. If it was working fine for you before then I would suggest going back the way you had it before. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;On another note it might be helpful for us to see an arc catalog screen shot of your workspace folder with the raster files.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Dec 2015 19:14:12 GMT</pubDate>
    <dc:creator>LukeSturtevant</dc:creator>
    <dc:date>2015-12-09T19:14:12Z</dc:date>
    <item>
      <title>ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724670#M56116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #222426; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; background-color: rgba(248, 248, 248, 0.6);"&gt;I want the output file names of the raster split tool (ArcGis;&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000009v000000" rel="nofollow" style="font-size: 15px; color: #358daa; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background-color: rgba(248, 248, 248, 0.6);"&gt;http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000009v000000&lt;/A&gt;&lt;SPAN style="color: #222426; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; background-color: rgba(248, 248, 248, 0.6);"&gt;) to carry a specific attribute (not FID) of the polygon I used to split the raster file. How can I achieve this?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 09:27:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724670#M56116</guid>
      <dc:creator>LaraFaelivrin</dc:creator>
      <dc:date>2015-12-09T09:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724671#M56117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only way as far as I can see would be to run the Split Raster tool with your polygon grid, then rename each one afterwards with your attribute id. You would have to make sure that these are unique of course. Are these map sheet names / ids or something.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 12:08:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724671#M56117</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2015-12-09T12:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724672#M56118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The attribute is an ID which is different from the FID. Can the rename be done automatically? Renaming all of them manually would be laborious as the Split Raster tool created more than 100 files. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 12:26:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724672#M56118</guid>
      <dc:creator>LaraFaelivrin</dc:creator>
      <dc:date>2015-12-09T12:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724673#M56119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;The attribute is an ID which is different from the FID. Can the rename be done automatically? Renaming all of them manually would be laborious as the Split Raster tool created more than 100 files. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Maybe this can be done using an overlap query? &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 12:28:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724673#M56119</guid>
      <dc:creator>LaraFaelivrin</dc:creator>
      <dc:date>2015-12-09T12:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724674#M56120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use the &lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/modelbuilder-toolbox/iterate-rasters.htm"&gt;iterate rasters &lt;/A&gt;with the &lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/rename.htm"&gt;rename&lt;/A&gt; tool in a model builder. I almost think it would be easier to make a tool that i&lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/modelbuilder-toolbox/iterate-feature-selection.htm"&gt;terates features&lt;/A&gt;​ and then &lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/clip.htm"&gt;clips&lt;/A&gt; the rasters. You could use &lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/modelbuilder-toolbox/get-field-value.htm"&gt;get field value&lt;/A&gt;​ tool to generate the naming output.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 12:40:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724674#M56120</guid>
      <dc:creator>LukeSturtevant</dc:creator>
      <dc:date>2015-12-09T12:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724675#M56121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How can I rename the raster files based on a vector attribute with the iterate raster - rename approach?&lt;/P&gt;&lt;P&gt;The second approach worked (see script below) but using the Clip tool in a loop is substantially slower than the Split Raster tool:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #4d4d4d; font-family: Consolas, 'Andale Mono', 'Lucida Console', Monaco, 'Courier New', Courier, monospace;"&gt;cursor = arcpy.SearchCursor(Catchment)
for poly in cursor:
&amp;nbsp; print(poly.getValue(Outlet_ID))
&amp;nbsp; OutletID_poly = poly.getValue(Outlet_ID)
&amp;nbsp; Output_poly = Tile_chm_catchment2 + "/Tile_chm_catchment" + str(OutletID_poly) + ".tif "
&amp;nbsp; arcpy.Clip_management (CHM, "281898 706162 249670 761440", Output_poly, CHM, "", "NONE", "NO_MAINTAIN_EXTENT")
&amp;nbsp; print "Tile_chm_catchment_" + str(OutletID_poly) + " is done"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:59:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724675#M56121</guid>
      <dc:creator>LaraFaelivrin</dc:creator>
      <dc:date>2021-12-12T06:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724676#M56122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The iterate raster is a model builder tool only. If you want to use python. You would need to use either &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/functions/listrasters.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;List Rasters&lt;/A&gt;​ or &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/data-access/walk.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;walk&lt;/A&gt;​ to get a list of rasters you want to rename. You would need to run a &lt;A href="http://pro.arcgis.com/en/pro-app/arcpy/data-access/searchcursor-class.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Data Access Search Cursor&lt;/A&gt;​ on your polygon to match the FID row and get the field value that you want. Finally you would construct a string name using the field value and run &lt;A href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/rename.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;rename&lt;/A&gt;​ for each raster.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the split tool your output rasters are named something like "Raster_0" correct? So you would need to split that name to get the FID number and then run a da search cursor on your polygon feature like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env

env.workspace = #workspace path for your raster folder
polygon = # path to your polygon
fieldName = # Name of the field you want the value from

for raster in arcpy.ListRasters():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id = int(raster.split("_")[-1])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oidField = arcpy.Describe(feature).oidFieldName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldValue = arcpy.da.SearchCursor(feature,["OID@",fieldName],where_clause = '{0} =&amp;nbsp;&amp;nbsp;&amp;nbsp; {1}'.format(arcpy.AddFieldDelimiters(feature,oidField),id)).next()[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newName = "Raster_"+fieldValue
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.&lt;SPAN style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12.8px;"&gt;Rename_management(raster,newName)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDITED:I edited the code in hopes that it might clarify things a bit better. The raster.split("_") is assuming the raster names are something like 'Raster_0", but you may need to modify this to pull out the FID number.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:59:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724676#M56122</guid>
      <dc:creator>LukeSturtevant</dc:creator>
      <dc:date>2021-12-12T06:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724677#M56123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried to do this but I am doing something wrong... I think i did not implement the arcpy.da.SearchCursor correctly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# CHM = Raster Dataset
# Catchment = Vector Dataset
# Outlet_ID = Polygon_ID with I want to add to the Output of the Raster Split Tool

workspace = Tile_chm_catchment

walk = arcpy.da.Walk(workspace, datatype="RasterDataset", type="TIF")
feature_classes = []

for dirpath, dirnames, filenames in walk:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_classes.append(os.path.join(dirpath, filename))
#print feature_classes # Output =&amp;nbsp; u'//&lt;A href="http://service.geo.uzh.ch/private/kkaelin/data/Desktop/Eawag/Data_out/CHM/Tile_chm_catchment%5C%5CTile_chm_catchment_99.TIF" style="color: #1155cc;" target="_blank" rel="nofollow noopener noreferrer"&gt;.../Data_out/CHM/Tile_chm_catchment\\Tile_chm_catchment_99.TIF&lt;/A&gt;

# unicode to string
feature_class_string = [x.encode('UTF8') for x in feature_classes]
# print feature_class_string # Output = '/...&lt;A href="http://service.geo.uzh.ch/private/kkaelin/data/Desktop/Eawag/Data_out/CHM/Tile_chm_catchment%5C%5CTile_chm_catchment_99.TIF" style="color: #1155cc;" target="_blank" rel="nofollow noopener noreferrer"&gt;/Data_out/CHM/Tile_chm_catchment\\Tile_chm_catchment_99.TIF&lt;/A&gt;'

for feature in feature_class_string:
&amp;nbsp;&amp;nbsp;&amp;nbsp; #print feature
&amp;nbsp;&amp;nbsp;&amp;nbsp; Raster_Number =&amp;nbsp; re.findall('\d+', feature) # Raster_99 would lead to Raster_Number = 99
&amp;nbsp;&amp;nbsp;&amp;nbsp; #print Raster_Number # Output = ['99']
&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_class_string_NoNumber = ''.join([i for i in feature if not i.isdigit()])
&amp;nbsp;&amp;nbsp;&amp;nbsp; #print feature_class_string_NoNumber # Output = //&lt;A href="http://service.geo.uzh.ch/private/kkaelin/data/Desktop/Eawag/Data_out/CHM/Tile_chm_catchment%5CTile_chm_catchment_.TIF" style="color: #1155cc;" target="_blank" rel="nofollow noopener noreferrer"&gt;.../Data_out/CHM/Tile_chm_catchment\Tile_chm_catchment_.TIF&lt;/A&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_class_string_NoNumber_NoTif = feature_class_string_NoNumber[:-4]
&amp;nbsp;&amp;nbsp;&amp;nbsp; #print feature_class_string_NoNumber_NoTif # Output = //&lt;A href="http://service.geo.uzh.ch/private/kkaelin/data/Desktop/Eawag/Data_out/CHM/Tile_chm_catchment%5CTile_chm_catchment_" style="color: #1155cc;" target="_blank" rel="nofollow noopener noreferrer"&gt;.../Data_out/CHM/Tile_chm_catchment\Tile_chm_catchment_&lt;/A&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CHM_Input = feature
&amp;nbsp;&amp;nbsp;&amp;nbsp; oidField = arcpy.Describe(CHM_Input).oidFieldName
&amp;nbsp;&amp;nbsp;&amp;nbsp; #print oid_Field
&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldValue = arcpy.da.SearchCursor(Catchment,["OID@","Outlet_ID"],where_clause = '{0} = {1}'.format(arcpy.AddFieldDelimiters(CHM_Input, oidField),id)) # ID@ —The value of the ObjectID field
&amp;nbsp;&amp;nbsp;&amp;nbsp; #printfieldValue
&amp;nbsp;&amp;nbsp;&amp;nbsp; Rename_Output = str(feature_class_string_NoNumber_NoTif) + str(fieldValue) + ".tif"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.rename_management(fieldname_string, Rename_Output)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:59:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724677#M56123</guid>
      <dc:creator>LaraFaelivrin</dc:creator>
      <dc:date>2021-12-12T06:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724678#M56124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like you did not assign your 'id' for the search cursor. Try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;Raster_Number =&amp;nbsp; int(re.findall('\d+', feature)[0])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;then your search cursor would be &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14496889369041624 jive_text_macro" data-renderedposition="132_8_912_16" jivemacro_uid="_14496889369041624"&gt;&lt;SPAN style="color: #222222; font-size: small; font-family: arial, sans-serif;"&gt;fieldValue = arcpy.da.SearchCursor(Catchment,["OID@","Outlet_ID"],where_clause = '{0} = {1}'.format(arcpy.AddFieldDelimiters(CHM_Input, oidField),&lt;SPAN style="color: #222222; font-size: small; font-family: arial, sans-serif;"&gt;&lt;STRONG&gt;Raster_Number&lt;/STRONG&gt;&lt;/SPAN&gt;)).next()[1]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-size: small; font-family: arial, sans-serif;"&gt;I think you can skip a step or two in creating your output string like removing the '.tif'. You could just set &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-size: small; font-family: arial, sans-serif;"&gt;feature_class_string_NoNumber_NoTif = ''.join([i for i in &lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;feature&lt;/SPAN&gt; if not i.isdigit()]).split(".")[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 17:48:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724678#M56124</guid>
      <dc:creator>LukeSturtevant</dc:creator>
      <dc:date>2015-12-09T17:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724679#M56125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much for your help!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When running the arcpy rename function I get the Error 9999: Error executing function&lt;/LI&gt;&lt;/UL&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When printing the &lt;STRONG&gt;Rename_Output &lt;/STRONG&gt;I get the following string: &lt;BR /&gt;&lt;BR /&gt;//&lt;A href="http://service.geo.uzh.ch/private/kkaelin/data/Desktop/Eawag/Data_out/CHM/Tile_chm_catchment" style="color: #1155cc;" target="_blank"&gt;service.geo.uzh.ch/private/test/data/Desktop/Test/Data_out/CHM/Tile_chm_catchment&lt;/A&gt;&lt;SPAN style="font-size: 14pt;"&gt;&lt;STRONG&gt;\&lt;/STRONG&gt;&lt;/SPAN&gt;Tile_chm_catchment_&amp;lt;da.SearchCursor object at 0x00000000054E6870&amp;gt;.tif&lt;BR /&gt;&lt;BR /&gt;--&amp;gt; The slash before Tile_chm_catchment is in the wrong direction (this is the output of the walk function which I copied from the ArcGIS help). Why does this happen? Does this have to be changed? &lt;BR /&gt;&lt;BR /&gt;--&amp;gt; The da.SearchCursor is an object. Why is not a number?&lt;/LI&gt;&lt;/UL&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When applying "feature_class_string_NoNumber_NoTif = ''.join([i for i in feature if not i.isdigit()]).split(".")[0]" it somehow adds "//service" to the line. I have no clue why this happens.&lt;/LI&gt;&lt;/UL&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;See updated code:&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;&lt;/P&gt;&lt;P style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;&lt;/P&gt;&lt;DIV&gt;# CHM = Raster Dataset&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Catchment = Vector Dataset&lt;/P&gt;&lt;P&gt;# Outlet_ID = Polygon_ID with I want to add to the Output of the Raster Split Tool&lt;/P&gt;&lt;P&gt;workspace = Tile_chm_catchment&lt;/P&gt;&lt;P&gt;walk = arcpy.da.Walk(workspace, datatype="RasterDataset", type="TIF")&lt;/P&gt;&lt;P&gt;feature_classes = []&lt;/P&gt;&lt;P&gt;for dirpath, dirnames, filenames in walk:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for filename in filenames:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_classes.append(os.path.join(dirpath, filename))&lt;/P&gt;&lt;P&gt;print feature_classes # Output =&amp;nbsp; u'///Data_out/CHM/Tile_chm_catchment\\Tile_chm_catchment_99.TIF&lt;/P&gt;&lt;P&gt;# unicode to string&lt;/P&gt;&lt;P&gt;feature_class_string = [x.encode('UTF8') for x in feature_classes]&lt;/P&gt;&lt;P&gt;# print feature_class_string # Output = '//.../Data_out/CHM/Tile_chm_catchment\\Tile_chm_catchment_99.TIF'&lt;/P&gt;&lt;P&gt;for feature in feature_class_string:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print feature # Output = //&lt;A href="http://service.geo.uzh.ch/private/kkaelin/data/Desktop/Eawag/Data_out/CHM/Tile_chm_catchment%5CTile_chm_catchment_99.TIF" style="color: #1155cc;" target="_blank"&gt;..../Data_out/CHM/Tile_chm_catchment\Tile_chm_catchment_99.TIF&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Raster_Number =&amp;nbsp; int(re.findall('\d+', feature)[0]) # Raster_99 would lead to Raster_Number = 99&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print Raster_Number # Output = ['99']&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_class_string_NoNumber_NoTif = ''.join([i for i in feature if not i.isdigit()]).split(".")&lt;/P&gt;&lt;P&gt;##&amp;nbsp;&amp;nbsp;&amp;nbsp; print feature_class_string_NoNumber_NoTif[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_class_string_NoNumber = ''.join([i for i in feature if not i.isdigit()])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print feature_class_string_NoNumber # Output = //.../Data_out/CHM/Tile_chm_catchment\Tile_chm_catchment_.TIF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature_class_string_NoNumber_NoTif = feature_class_string_NoNumber[:-4]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print feature_class_string_NoNumber_NoTif # Output = ///Data_out/CHM/Tile_chm_catchment\Tile_chm_catchment_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CHM_Input = feature&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oidField = arcpy.Describe(Catchment).oidFieldName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print oidField&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldValue = arcpy.da.SearchCursor(Catchment,["OID@","Outlet_ID"],where_clause = '{0} = {1}'.format(arcpy.AddFieldDelimiters(CHM_Input, oidField),Raster_Number)) # ID@ —The value of the ObjectID field&amp;nbsp;&amp;nbsp; fieldValue = arcpy.da.SearchCursor(Catchment,["OID@","Outlet_ID"],where_clause = '{0} = {1}'.format(arcpy.AddFieldDelimiters(CHM_Input, oidField),id)) # ID@ —The value of the ObjectID field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #printfieldValue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rename_Output = str(feature_class_string_NoNumber_NoTif) + str(fieldValue) + ".tif"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print Rename_Output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Rename_management(feature, Rename_Output)&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 19:04:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724679#M56125</guid>
      <dc:creator>LaraFaelivrin</dc:creator>
      <dc:date>2015-12-09T19:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724680#M56126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lara, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm guessing you are getting an error because of the search cursor. I think I forgot to finish the code for the search cursor the last time I gave it to you. It should be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;arcpy.da.SearchCursor(Catchment,["OID@","Outlet_ID"],where_clause = '{0} = {1}'.format(arcpy.AddFieldDelimiters(CHM_Input, oidField),&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-weight: bold; font-size: 13px; font-family: inherit; font-style: inherit;"&gt;Raster_Number&lt;/SPAN&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;)).next()[1]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;I'm not sure why you are getting a "\\Service" tagged to your output name. If it was working fine for you before then I would suggest going back the way you had it before. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif; font-size: small;"&gt;On another note it might be helpful for us to see an arc catalog screen shot of your workspace folder with the raster files.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 19:14:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724680#M56126</guid>
      <dc:creator>LukeSturtevant</dc:creator>
      <dc:date>2015-12-09T19:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724681#M56127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IT WORKED &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;Thanks!! &lt;/P&gt;&lt;P&gt;One last question: The direction of the slash always seemed to matter. Why does it not matter here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 19:31:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724681#M56127</guid>
      <dc:creator>LaraFaelivrin</dc:creator>
      <dc:date>2015-12-09T19:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724682#M56128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The double backslash or the a single forward slash can be used for &lt;A href="http://stackoverflow.com/questions/12288679/python-storing-path-names-with-forward-vs-backward-slash"&gt;storing and parsing paths&lt;/A&gt;. A single backslash is an &lt;A href="http://learnpythonthehardway.org/book/ex10.html"&gt;escape character&lt;/A&gt;​ in the python language so that would cause problems if you were attempting to use that. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 19:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724682#M56128</guid>
      <dc:creator>LukeSturtevant</dc:creator>
      <dc:date>2015-12-09T19:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Split Tool: How to change output name prefix based on polygon attribute</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724683#M56129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But I did use a single backslash character: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;//.../Data_out/CHM/Tile_chm_catchment&lt;STRONG&gt;\&lt;/STRONG&gt;Tile_chm_catchment_.TIF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But maybe the print output just hides the second one because after all it worked! &lt;/P&gt;&lt;P&gt;Many thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2015 19:53:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-split-tool-how-to-change-output-name-prefix/m-p/724683#M56129</guid>
      <dc:creator>LaraFaelivrin</dc:creator>
      <dc:date>2015-12-09T19:53:06Z</dc:date>
    </item>
  </channel>
</rss>

