1

Is there a way to access the "export footprints" function for an unmanaged raster catalog with arcpy? It can be done through ArcMap when a raster catalog is added to the map as seen below.

Export footprints from the GUI

The context is that I am working on a python script to automate the process of adding rasters to an unmanaged catalog, and then exporting the footprints. The raster catalog is in a file geodatabase.

1 Answer 1

2

I believe little modification to this:

# Import arcpy module
import arcpy, traceback, os, sys
from arcpy import env
env.overwriteOutput = True

try:
    # input folder with shapefiles or rasters
    inputFolder = arcpy.GetParameterAsText(0)
    env.workspace = inputFolder
    # output folder for tiles shapefile
    outputFolder = arcpy.GetParameterAsText(1)
    # output shapefile name
    outputFile = "tiles.shp"
    theType=arcpy.GetParameterAsText(2)

    if theType=='Shapefile':
        inRasters = arcpy.ListFeatureClasses()
    elif theType=='Raster':
        inRasters = arcpy.ListRasters()
    arcpy.AddMessage(len(inRasters))

    arcpy.CreateFeatureclass_management(outputFolder, outputFile, "POLYGON", "", "DISABLED", "DISABLED", "", "", "0", "0", "0")
    outputFile=outputFolder+ os.sep +outputFile
    arcpy.AddField_management(outputFile, "FILE_NAME", "TEXT", "", "", 250, "", "NON_NULLABLE", "NON_REQUIRED", "")

    inRows = arcpy.da.InsertCursor(outputFile,("Shape@","FILE_NAME"))
    arcpy.SetProgressor("step", "", 0, len(inRasters))
    for inRaster in inRasters:
        desc = arcpy.Describe(inRaster)
        ext=desc.extent
        thePoints=arcpy.Array([ext.lowerLeft, ext.upperLeft,ext.upperRight,ext.lowerRight])
        polygon = arcpy.Polygon(thePoints)
        inRows.insertRow((polygon,inputFolder+os.sep+inRaster))
        arcpy.SetProgressorPosition()
        arcpy.AddMessage (inRaster + "...processed")

    del inRows
except:
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n    " + \
            str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"
    msgs = "GEOPROCESSOR ERRORS:\n" + arcpy.GetMessages(2) + "\n"
    arcpy.AddError(msgs)
    arcpy.AddError(pymsg)

enter image description here

Will get you there

2
  • Thanks @FelixIP, I will try this out and let you know how it works. Feb 19, 2016 at 0:44
  • This does work, but it I found it simpler to use copy features on the raster catalog, and it creates a polygon feature class with the footprints. Feb 3, 2017 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.