<?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: Working with RASTER type fields in ArcGIS 10.0 and Python 2.6.5 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/working-with-raster-type-fields-in-arcgis-10-0-and/m-p/377695#M29780</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Gaston,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In theory it is not very difficult to transform the code from an "arcpy.da" search cursor to the "arcpy" cursor. The problem is that the arcpy.SearchCursor does not seem to support raster fields. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;The arcpy.da method that works:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os
output_path = r'C:\Forum\Raster attribute\output'

fc = r'C:\Forum\Raster attribute\test.gdb\rasatt01'
fld_raster = 'Raster'
fld_name = 'Name'
flds = (fld_raster, fld_name)

with arcpy.da.SearchCursor(fc, flds) 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; filename = "{0}.tif".format(row[1])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0].save(os.path.join(output_path, filename))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;The arcpy method that doesn't work:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os
output_path = r'C:\Forum\Raster attribute\output'

fc = r'C:\Forum\Raster attribute\test.gdb\rasatt01'
fld_raster = 'Raster'
fld_name = 'Name'

cursor = arcpy.SearchCursor(fc)
for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = "{0}.tif".format(row.getValue(fld_name))
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.getValue(fld_raster).save(os.path.join(output_path, filename))

del cursor, row&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will throw an error "&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;AttributeError: 'NoneType' object has no attribute 'save'&lt;/SPAN&gt;&lt;SPAN&gt;".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You might be interested in a similar thread regarding Blob fields and Raster fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/108402-How-to-load-image-to-Raster-attribute-field-with-python?p=387169&amp;amp;viewfull=1#post387169" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/108402-How-to-load-image-to-Raster-attribute-field-with-python?p=387169&amp;amp;viewfull=1#post387169&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 17:26:14 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2021-12-11T17:26:14Z</dc:date>
    <item>
      <title>Working with RASTER type fields in ArcGIS 10.0 and Python 2.6.5</title>
      <link>https://community.esri.com/t5/python-questions/working-with-raster-type-fields-in-arcgis-10-0-and/m-p/377694#M29779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the following problem. I need to export a bunch of photos from a raster field in a feature class in SDE, naming them by some property of the feature class. I know to export them by hand, one by one, but but there are thousands of photos to extrat from de SDE GDB. I have found a pretty nice script for this task, &lt;/SPAN&gt;&lt;A href="http://esriaustraliatechblog.wordpress.com/2014/02/25/how-to-export-your-raster-datasets-referenced-in-a-raster-attribute-field-file-geodatabase-using-python/"&gt;http://esriaustraliatechblog.wordpress.com/2014/02/25/how-to-export-your-raster-datasets-referenced-in-a-raster-attribute-field-file-geodatabase-using-python/&lt;/A&gt;&lt;SPAN&gt; but my problem is that I am working with an old version of arcpy (ArcGIS 10.0 and Python 2.6.5), which does not have the Data Access Module �??da�??, used in this script, i.e. arcpy.da.SearchCursor().&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So, since I am not very skilled in Python coding, i need help to modify the script to make it compatible with my older version of arcpy, perhaps using arcpy.SearchCursor() instead of the newly 'da' version of SearchCursor().&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am also interested in bulk import of photos to a raster field, i.e. given a folder with the pictures, load them in the correponding raster field in the feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In summary, I need help with some tips to bulk reading and writing in raster type fields using Python in ArcGIS 10.0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Gaston.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 13:07:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-raster-type-fields-in-arcgis-10-0-and/m-p/377694#M29779</guid>
      <dc:creator>GastonIzaguirre</dc:creator>
      <dc:date>2014-06-10T13:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Working with RASTER type fields in ArcGIS 10.0 and Python 2.6.5</title>
      <link>https://community.esri.com/t5/python-questions/working-with-raster-type-fields-in-arcgis-10-0-and/m-p/377695#M29780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Gaston,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In theory it is not very difficult to transform the code from an "arcpy.da" search cursor to the "arcpy" cursor. The problem is that the arcpy.SearchCursor does not seem to support raster fields. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;The arcpy.da method that works:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os
output_path = r'C:\Forum\Raster attribute\output'

fc = r'C:\Forum\Raster attribute\test.gdb\rasatt01'
fld_raster = 'Raster'
fld_name = 'Name'
flds = (fld_raster, fld_name)

with arcpy.da.SearchCursor(fc, flds) 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; filename = "{0}.tif".format(row[1])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0].save(os.path.join(output_path, filename))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;&lt;STRONG&gt;The arcpy method that doesn't work:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os
output_path = r'C:\Forum\Raster attribute\output'

fc = r'C:\Forum\Raster attribute\test.gdb\rasatt01'
fld_raster = 'Raster'
fld_name = 'Name'

cursor = arcpy.SearchCursor(fc)
for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; filename = "{0}.tif".format(row.getValue(fld_name))
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.getValue(fld_raster).save(os.path.join(output_path, filename))

del cursor, row&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will throw an error "&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;AttributeError: 'NoneType' object has no attribute 'save'&lt;/SPAN&gt;&lt;SPAN&gt;".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You might be interested in a similar thread regarding Blob fields and Raster fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/108402-How-to-load-image-to-Raster-attribute-field-with-python?p=387169&amp;amp;viewfull=1#post387169" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/108402-How-to-load-image-to-Raster-attribute-field-with-python?p=387169&amp;amp;viewfull=1#post387169&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:26:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-raster-type-fields-in-arcgis-10-0-and/m-p/377695#M29780</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T17:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: Working with RASTER type fields in ArcGIS 10.0 and Python 2.6.5</title>
      <link>https://community.esri.com/t5/python-questions/working-with-raster-type-fields-in-arcgis-10-0-and/m-p/377696#M29781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Xander,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your quick response, it has been very helpful. You're right, I've tried the arcpy method (I could not try arcpy.da because of my version of ArcGIS) and it seems that does not support raster fields.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Apparently the most practical solution is to get an ArcGIS version 10.2...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll keep researching and trying to solve this problem with my current version of software. Otherwise I'll have to switch to a new version.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Gaston.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 10:29:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-raster-type-fields-in-arcgis-10-0-and/m-p/377696#M29781</guid>
      <dc:creator>GastonIzaguirre</dc:creator>
      <dc:date>2014-06-11T10:29:17Z</dc:date>
    </item>
  </channel>
</rss>

