import arcgisscripting gp = arcgisscripting.create(9.3) gp.overwriteoutput = 'true' # here's where you need to define some variables, only 4: gp.workspace = r'< insert full root path to directory containing image tiles >' coord_system = 'PROJCS[< insert coord sys params here >]' GridName = '< your shapefile (you can convert to fc later, as you wish) >' IMAGEfldLen = < your numeric length value for the image name field (suggest 50 or less) > gp.CreateFeatureClass_management(gp.workspace, GridName, 'POLYGON', '', '', '', coord_system) fields = ['IMAGE', 'XMIN', 'XMAX', 'YMIN', 'YMAX'] gp.AddField_management(GridName, fields[0], 'TEXT', '', '', IMAGEfldLen) for i in range(1, 5): gp.AddField_management(GridName, fields, 'DOUBLE', 18, 17) print "added field: " + fields rasters = gp.ListRasters() arrayObj = gp.CreateObject('Array') outRows = gp.InsertCursor(GridName) for raster in rasters: extent = gp.describe(raster).extent arrayObj.add(extent.lowerleft) arrayObj.add(extent.lowerright) arrayObj.add(extent.upperright) arrayObj.add(extent.upperleft) arrayObj.add(extent.lowerleft) feat = outRows.NewRow() feat.Shape = arrayObj image = '.\\' + raster feat.SetValue('IMAGE', image) feat.SetValue('XMIN', extent.xmin) feat.SetValue('YMIN', extent.ymin) feat.SetValue('XMAX', extent.xmax) feat.SetValue('YMAX', extent.ymax) outRows.InsertRow(feat) arrayObj.RemoveAll() del outRows
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.