I have a small script to search through a featureclass and copy and entire row to another featureclass. Its working well, in that I get all of the attributes for the row, but there is no geometry for the layer and no shapes appear. It is a POLYLINE layer and all of my shape_lengths = 0
import arcpy from arcpy import env arcpy.env.overwriteOutput = True env.workspace = r"C:\temp\gamma\Gamma_Survey_With_Lines.gdb" Detector_Line = env.workspace + "/Detector_Line" GammaDetectionLocation = env.workspace + "/GammaDetectionLocation" arcpy.MakeFeatureLayer_management(GammaDetectionLocation, "GammaDetectionLocation1") #lyr2Explode = arcpy.CreateFeatureclass_management("in_memory", "CopyOfGammaDetectionLocation", "POLYLINE",GammaDetectionLocation,"DISABLED","DISABLED",GammaDetectionLocation) lyr2Explode = arcpy.CreateFeatureclass_management(env.workspace, "CopyofDetectorLine", "POLYLINE",Detector_Line,"DISABLED","DISABLED",Detector_Line) with arcpy.da.SearchCursor(Detector_Line,"*") as sCur: with arcpy.da.InsertCursor(lyr2Explode,"*") as iCur: for row in sCur: print(row[17]) globalid = row[17] arcpy.SelectLayerByAttribute_management("GammaDetectionLocation1", "NEW_SELECTION", "SourceTrack = '" + globalid + "'") count = int(arcpy.GetCount_management("GammaDetectionLocation1").getOutput(0)) if(count == 0): print count iCur.insertRow(row)
أكثر...
import arcpy from arcpy import env arcpy.env.overwriteOutput = True env.workspace = r"C:\temp\gamma\Gamma_Survey_With_Lines.gdb" Detector_Line = env.workspace + "/Detector_Line" GammaDetectionLocation = env.workspace + "/GammaDetectionLocation" arcpy.MakeFeatureLayer_management(GammaDetectionLocation, "GammaDetectionLocation1") #lyr2Explode = arcpy.CreateFeatureclass_management("in_memory", "CopyOfGammaDetectionLocation", "POLYLINE",GammaDetectionLocation,"DISABLED","DISABLED",GammaDetectionLocation) lyr2Explode = arcpy.CreateFeatureclass_management(env.workspace, "CopyofDetectorLine", "POLYLINE",Detector_Line,"DISABLED","DISABLED",Detector_Line) with arcpy.da.SearchCursor(Detector_Line,"*") as sCur: with arcpy.da.InsertCursor(lyr2Explode,"*") as iCur: for row in sCur: print(row[17]) globalid = row[17] arcpy.SelectLayerByAttribute_management("GammaDetectionLocation1", "NEW_SELECTION", "SourceTrack = '" + globalid + "'") count = int(arcpy.GetCount_management("GammaDetectionLocation1").getOutput(0)) if(count == 0): print count iCur.insertRow(row)
أكثر...