Iterate Rasters in a Raster Catalog

Discussion created by acorcoran72 on Aug 31, 2012
Latest reply on Sep 4, 2012 by jskinner-esristaff
How do you get individual rasters from within a raster catalog in Python?

I'm trying to:

  1. Get each raster in a raster catalog

  2. See if they are single band integer

  3. If they are then calculate the raster attribute table

The raster catalog is stored in a SQL Server database and I need to automate building of raster attribute tables so that all users can then use the 'Classify' raster dataset renderer in ArcMap. They can't use this at the moment as they do not have 'CREATE TABLE' permissions in SQL Server and I really don't want to give them that permission.

So far I have:

import arcpy

arcpy.env.workspace = r"Database Connections\\RASTER.sde"

arcpy.MakeRasterCatalogLayer_management("catalogName", "temp")

rows = arcpy.SearchCursor("temp")
for row in rows:
    raster = arcpy.Raster(row.Raster)

It bombs out at the 'arcpy.Raster' creation with 'TypeError: expected a raster or layer name'

Thanks in advance for any help.