IntersectLyr = arcpy.MakeFeatureLayer_management(BufferPoly, "buffpolylyr") fcList = arcpy.ListFeatureClasses("selfts_*", "Polygon") for fc in fcList: desc = arcpy.Describe(fc) outFC = desc.baseName.strip("selfts_") + "_Intersect" in_features = [IntersectLyr, fc] #Perform Intersect between bufferpoly and selected features in each habitat feature class arcpy.Intersect_analysis(in_features, outFC) arcpy.AddField_management(outFC, "PERCENTAGE", "Double") des = arcpy.Describe(outFC) outFClyr = des.baseName + "lyr" arcpy.MakeFeatureLayer_management(outFC, outFClyr) arcpy.AddMessage("The Intersect Layer is: " + str(outFClyr)) arcpy.AddJoin_management(outFClyr, "FID_ProjectRadius", IntersectLyr, "OBJECTID") fldList = arcpy.ListFields(outFClyr, "*.PERCENTAGE") for fld in fldList: percentfld = fld.name arcpy.AddMessage(fld.name) fldList2 = arcpy.ListFields(outFClyr, "*.Shape_Area") for fld in fldList2: if fld.name == "ProjectRadius.Shape_Area": arcpy.AddMessage(fld.name) buffareafld = fld.name else: arcpy.AddMessage(fld.name) areafld = fld.name cur = arcpy.UpdateCursor(outFClyr) for row in cur: buffarea = row.getValue(buffareafld) habarea = row.getValue(areafld) row.percentfld = (buffarea/habarea)*100 cur.updateRow(row) del cur, row
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.