Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Accessing Paths for rasters in a mosaic dataset

$
0
0
Hi everybody!

Can anyone direct me to the best method for getting the paths to rasters that are managed by a mosaic dataset. I see that there is a raster object stored in the attribute table of the mosaic footprints. I thought perhaps that will store the information that I am after. So I tried this:

Code:

arcpy.MakeMosaicLayer_management(r'C:\Users\Marc\Documents\ArcGIS\Raster_Mosaic\Waiheke_Imagery_Mosaic.gdb\waiheke_test_mosaic', 'mosaic')

fc = 'mosaic\Footprint'

field = ['Raster']

with arcpy.da.SearchCursor(fc, field) as cursor:
    for row in cursor:
        print row[0].name
None
None
None

and this:

Code:

with arcpy.da.SearchCursor(fc, field) as cursor:
    for row in cursor:
        print row[0].path
None
None
None

Then I thought maybe I need to use the describe function:

Code:

with arcpy.da.SearchCursor(fc, field) as cursor:
    for row in cursor:
        desc = arcpy.Describe(row[0])       
        print desc.name
AMD_waiheke_test_mosaic_CAT\Raster.OBJECTID = 1
AMD_waiheke_test_mosaic_CAT\Raster.OBJECTID = 2
AMD_waiheke_test_mosaic_CAT\Raster.OBJECTID = 3

Code:

with arcpy.da.SearchCursor(fc, field) as cursor:
    for row in cursor:
        desc = arcpy.Describe(row[0])       
        print desc.path
C:\Users\Marc\Documents\ArcGIS\Raster_Mosaic_FME_Tests\Waiheke_Imagery_Mosaic.gdb\AMD_waiheke_test_mosaic_CAT
C:\Users\Marc\Documents\ArcGIS\Raster_Mosaic_FME_Tests\Waiheke_Imagery_Mosaic.gdb\AMD_waiheke_test_mosaic_CAT
C:\Users\Marc\Documents\ArcGIS\Raster_Mosaic_FME_Tests\Waiheke_Imagery_Mosaic.gdb\AMD_waiheke_test_mosaic_CAT

Obviously none of these are returning the filenames or the paths to the original rasters. Can anybody tell me if I am doing something completely wrong, or if this is just not possible.

I see there is this tool: http://resources.arcgis.com/en/help/...000017m000000/ but I would like to access the paths directly, rather than having to use an intermediate dbf file.

Thanks heaps,

Marc

Viewing all articles
Browse latest Browse all 2485

Trending Articles