I have a folder tree with many other folders in it containing many images. I have managed to make a script that will parse through the entire folder and find every image in it. It then uses raster domain to create a polygon shapefile of every footprint for each image.
The issue I am having is I need to have those footprints exported to a single folder named "index". The current script always exports the footprints to the same folder the image is located in. How can I change my script to export the raster domain footprints to the "index" folder instead of them being exported to the folder containing the imagery?
Here is my script:
import arcpy
import os
workspace = r”D:\Folder\Test”
outFile = r”D:\Folder\Index”
rasters = []
arcpy.CheckOutExtension(“3D”)
print ‘Processing’
for dirpath, dirnames, filenames, in arcpy.da.Walk(workspace, topdown=True, datatype=”RasterDataset”):
for filename in filenames:
rasters.append(os.path.join(dirpath, filename))
for raster in rasters:
outGeom = “POLYGON”
outPoly = raster[:-4]+”.shp”
arcpy.RasterDomain_3d(raster, outPoly, outGeom)
print rasters
print ‘Completed’
I'm pretty sure the answer lies with changing the "outPoly" parameter but anything I have tried resulted in an error. Any help would be much appreciated.
Thank you for your time.