inputRaster = r"C:\MyRaster" desc = arcpy.Describe(inputRaster) ext = desc.extent ll = ext.lowerLeft ul = ext.upperLeft lr = ext.lowerRight ur = ext.upperRight arcpy.CreateFeatureclass_management(r"C:\Documents\ArcGIS\Default.gdb","extentoutput", "POLYGON") outFC = r"C:\Documents\ArcGIS\Default.gdb\extentoutput" array = arcpy.Array([ll, ul, ur, lr]) pg = arcpy.Polygon(array) with arcpy.da.InsertCursor(outFC, ["SHAPE@"]) as cursor: cursor.insertRow([pg])
inputRaster = r"C:\MyRaster" desc = arcpy.Describe(inputRaster) ext = desc.extent ll = ext.lowerLeft ul = ext.upperLeft lr = ext.lowerRight ur = ext.upperRight arcpy.CreateFeatureclass_management(r"C:\Documents\ArcGIS\Default.gdb","extentoutput", "POLYLINE") outFC = r"C:\Documents\ArcGIS\Default.gdb\extentoutput" array = arcpy.Array([ll, ul, ur, lr, ll]) pl = arcpy.Polyline(array) with arcpy.da.InsertCursor(outFC, ["SHAPE@"]) as cursor: cursor.insertRow([pl])
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.