foofighters

Put Raster Properties into table

Discussion created by foofighters on Oct 5, 2012
Latest reply on Nov 9, 2012 by curtvprice
Hi,

maybe someone is able to help me with my problem (I'm new to python :)):

I try to get some raster data into a table with a python script but I get the following error:

Traceback (most recent call last):
File "C:/Users/Jann/Dropbox/EGEOS/Büro/2012/Projekte/Georeferenzierung in Attributtabelle/Online.py", line 21, in <module>
row.top = arcpy.GetRasterProperties_management(raster, "top")
File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\_base.py", line 35, in __setattr__
return setattr(self._arc_object, attr, ao)
ValueError: Row: Invalid input value for setting

My script looks like this:

import arcpy
from arcpy import env
env.workspace = "E:/Data/X-005"

# Create table
if arcpy.Exists("E:/Data/X-005/Test.dbf"):
arcpy.Delete_management("E:/Data/X-005/Test.dbf")

table = arcpy.CreateTable_management("E:/Data/X-005", "Test.dbf")

# Add fields
arcpy.AddField_management(table, "name", "TEXT")
arcpy.AddField_management(table, "top", "TEXT")

# Insert values
rows = arcpy.InsertCursor("E:/Data/X-005/Test.dbf")
rasters = arcpy.ListRasters()

for raster in rasters:
row = rows.newRow()
row.top = arcpy.GetRasterProperties_management(raster, "top")
row.name = raster

rows.insertRow(row)

# Delete cursor and row objects ro remove locks on the data
#
del row
del rows


Maybe someone can give me some tipps.

Best regards,
Jann

Outcomes