steffen111

get raster properties of each raster in mosaic dataset

Discussion created by steffen111 on Nov 14, 2013
Latest reply on Mar 18, 2014 by sm970mn
Hello,
i have the following problem. i have a mosaic dataset with many raster data in it. Now, i want to address the properties of each raster dataset in this mosaic. i need to do this, because i want to control, which spatial reference system is defined in the metadata of the raster dataset.

Normally i would just query the properties of the raster dataset by requesting the file itself, but in my case, it is important, that i check the properties of the raster in the mosaic attribute table.

I already wrote some code but it didn't work.

 import arcpy
import os

arcpy.env.workspace = '...path to my fgdb...'
datasetList = arcpy.ListDatasets("*", "Mosaic")

for dataset in datasetList:
    print dataset
    arcpy.env.workspace = dataset
    rows = arcpy.SearchCursor(dataset,"","","Raster; Name") 
    for row in rows:
        print row.Name
        outraster = arcpy.Raster(row.Raster)


the raster dataset is stored in the attribute table in the column "Raster". i just want to store the raster data value in the attribute table in an arcpy.Raster object before i address the properties. But every time i run the script i get the error "TypeError: expected a raster or layer name". it seems, that python doesn't realize it, that this value is a raster file.

how do i get the raster properties of each raster in a mosaic dataset? thanks for your help.

regards

Outcomes