<?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: Change the name of a rasterdataset in an rastercatalog in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574616#M45030</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Have a look:&lt;BR /&gt;&lt;BR /&gt;[ATTACH=CONFIG]25331[/ATTACH]&lt;BR /&gt;&lt;BR /&gt;I can see the name in ArcCatalog but i can't find a way to work with it in python.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Since the container in the Raster Catalog that maintains the individual rasters is a table, then maybe you can run an UpdateCursor on the table's field that holds the name of the rasters?&amp;nbsp; Not sure and would have to test some things, but this snip lists out the individual raster names in one of my raster catalogs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rascat = r"C:\RasCat_05282013.gdb\May2013"
with arcpy.da.SearchCursor(rascat, "Name") as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("{0}".format(row[0]))
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 00:44:31 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2021-12-12T00:44:31Z</dc:date>
    <item>
      <title>Change the name of a rasterdataset in an rastercatalog</title>
      <link>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574613#M45027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i want to convert all rasterdatasets from tif to png. These rasterdataset are part of a rastercatalog.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a my code snippet that works pretty well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; datasetList = arcpy.ListDatasets("*","All")
 for dataset in datasetList:
&amp;nbsp; arcpy.RasterToOtherFormat_conversion(arcpy.Describe(dataset).file,test_PNG","PNG")
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But i don't know to rename the rasterdatasets from 1&lt;/SPAN&gt;&lt;STRONG&gt;.tif&lt;/STRONG&gt;&lt;SPAN&gt; to 1&lt;/SPAN&gt;&lt;STRONG&gt;.png&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried describe.file and describe.name but there ist only: Raster.OBJECTID=404. I can't find the real name that is shown in the column called "name".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 08:33:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574613#M45027</guid>
      <dc:creator>gismoe</dc:creator>
      <dc:date>2013-06-18T08:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Change the name of a rasterdataset in an rastercatalog</title>
      <link>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574614#M45028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I could be incorrect but I was under the impression that rasters in a Raster Catalog are rows in a table (in a FGDB), stored in the Raster Column.&amp;nbsp; That is, there is no file type like .png, .tif, etc... and searching for such files will turn up nothing because you "load" the cataog with those rasters, but the FGDB does not maintain them as individual .tif/.png files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: if the rasters in the Raster Catalog are not "managed", then the catalog simply maintains links to individual rasters (.tif, .png's) on disk.&amp;nbsp; In this case, you could specify the location/folder on disk, search for and replace the file extensions for each of the rasters.&amp;nbsp; Is this what you need to to do?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;james&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 11:35:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574614#M45028</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2013-06-18T11:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Change the name of a rasterdataset in an rastercatalog</title>
      <link>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574615#M45029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have a look:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]25331[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can see the name in ArcCatalog but i can't find a way to work with it in python.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2013 11:46:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574615#M45029</guid>
      <dc:creator>gismoe</dc:creator>
      <dc:date>2013-06-18T11:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Change the name of a rasterdataset in an rastercatalog</title>
      <link>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574616#M45030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Have a look:&lt;BR /&gt;&lt;BR /&gt;[ATTACH=CONFIG]25331[/ATTACH]&lt;BR /&gt;&lt;BR /&gt;I can see the name in ArcCatalog but i can't find a way to work with it in python.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Since the container in the Raster Catalog that maintains the individual rasters is a table, then maybe you can run an UpdateCursor on the table's field that holds the name of the rasters?&amp;nbsp; Not sure and would have to test some things, but this snip lists out the individual raster names in one of my raster catalogs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rascat = r"C:\RasCat_05282013.gdb\May2013"
with arcpy.da.SearchCursor(rascat, "Name") as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print("{0}".format(row[0]))
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:44:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574616#M45030</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-12T00:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Change the name of a rasterdataset in an rastercatalog</title>
      <link>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574617#M45031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Okay --- I tested this and it renames each raster in my raster catalog with a ".tif" extension to ".png"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import os, sys

rascat = r"C:\RasCat_05282013.gdb\May2013"
with arcpy.da.UpdateCursor(rascat, "Name") as updcursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in updcursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curname = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curname = curname.replace(".tif", ".png") 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = str(curname)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updcursor.updateRow(row)

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:44:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574617#M45031</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-12T00:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Change the name of a rasterdataset in an rastercatalog</title>
      <link>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574618#M45032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I made some little changes and it works pretty well!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 09:16:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574618#M45032</guid>
      <dc:creator>gismoe</dc:creator>
      <dc:date>2013-06-19T09:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Change the name of a rasterdataset in an rastercatalog</title>
      <link>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574619#M45033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I made some little changes and it works pretty well!!!&lt;BR /&gt;Thank you very much.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Let's see it then!&amp;nbsp; I like knowing other methods too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;j&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jun 2013 11:01:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574619#M45033</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2013-06-19T11:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Change the name of a rasterdataset in an rastercatalog</title>
      <link>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574620#M45034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've had some little trouble with &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;row[0]&lt;/PRE&gt;&lt;SPAN&gt;. =&amp;gt; !underlying Database......index....! and so on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So here is my new code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rows = arcpy.UpdateCursor("d:/rasterdata.sde/BLP_Rasterdaten_PNG") 
for row in rows:
&amp;nbsp; curname = row.NAME
&amp;nbsp; curname = curname.replace(".tif", ".png") 
&amp;nbsp; row.NAME = str(curname)
&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's all. Mostly copied from ESRI-Help and nothing new. Sorry!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:44:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-the-name-of-a-rasterdataset-in-an/m-p/574620#M45034</guid>
      <dc:creator>gismoe</dc:creator>
      <dc:date>2021-12-12T00:44:36Z</dc:date>
    </item>
  </channel>
</rss>

