import arcpy from arcpy import env import csv #Location of raster files to be processed rasterWS = "C:/JP2" env.workspace = rasterWS #List of rasters within workspace; may need to change file type rasterList = arcpy.ListRasters("*", "JP2") #Open csv file for writing. #If you wish to append rows to an existing file, change argument to "ab" (append) #Without "ab" argument, an existing file will be overwritten with open("testcsv.csv", "wb") as csvfile: fileWriter = csv.writer(csvfile) #Write Column Headers headers = ["Filename","XMin", "YMin", "XMax","YMax", "ZMin","ZMax","MMin","MMax"] fileWriter.writerow(headers) for rasterFile in rasterList: #Create raster object and get properties raster = arcpy.Raster(rasterFile) name = raster.name extent = raster.extent #Create list from extent string, prepend filename to list, and write list as row in csv writeData = str(extent).split() writeData.insert(0, name) fileWriter.writerow(writeData)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.