scursor=gp.SearchCursor(Clip_Feature) row=scursor.Next() while row: if row.GetValue("Region") == 'Murray Inland': for ext in [".shp",".shx",".sbn",".dbf",".prj",".sbx"]: os.remove("C:\\Temp\\Contour"+ext) del scursor
scursor=gp.SearchCursor(Clip_Feature) row=scursor.Next() while row: if row.GetValue("Region") == 'Murray Inland': for ext in [".shp",".shx",".sbn",".dbf",".prj",".sbx"]: os.remove("C:\\Temp\\Contour"+ext) row=scursor.Next() del scursor
scursor=gp.SearchCursor(Clip_Feature) row=scursor.Next() while row: if row.GetValue("Region") == 'Murray Inland': for ext in [".shp",".shx",".sbn",".dbf",".prj",".sbx"]: os.remove("C:\\Temp\\Contour"+ext) break row=scursor.Next() del scursor
import sys, string, os, arcgisscripting gp = arcgisscripting.create(9.3) Mooring_Structure = "Mooring_Structure.shp" P_L = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines" Clip_Feature = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Clip_Feature\\Clip_Feature.shp" if gp.Exists(Clip_Feature): gp.FeatureClassToFeatureClass_conversion("\\\\Atlas\\data\\geodata\\statelamblands\\moor_struct\\arc ", P_L, Mooring_Structure, "") gp.workspace = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Clip_Feature" scursor=gp.SearchCursor(Clip_Feature) row=scursor.Next() while row: if row.GetValue("Region") == 'North Coast': if gp.Exists("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp"): gp.Delete_management("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp") break row=scursor.Next() del scursor
import sys, string, os, arcgisscripting gp = arcgisscripting.create(9.3) Mooring_Structure = "Mooring_Structure.shp" P_L = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines" Clip_Feature = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Clip_Feature\\Clip_Feature.shp" gp.FeatureClassToFeatureClass_conversion("\\\\Atlas\\data\\geodata\\statelamblands\\moor_struct\\arc", P_L, Mooring_Structure, "") gp.workspace = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Clip_Feature" scursor=gp.SearchCursor(Clip_Feature) row=scursor.Next() while row: if row.GetValue("Region") == 'South Coast': gp.Delete_management("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp") break row=scursor.Next() del scursor
import sys, string, os, arcgisscripting gp = arcgisscripting.create(9.3) Mooring_Structure = "Mooring_Structure.shp" P_L = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines" Clip_Feature = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Clip_Feature\\Clip_Feature.shp" gp.FeatureClassToFeatureClass_conversion("\\\\Atlas\\data\\geodata\\statelamblands\\moor_struct\\arc", P_L, Mooring_Structure, "") gp.workspace = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Clip_Feature" scursor=gp.SearchCursor(Clip_Feature) row=scursor.Next() while row: if row.GetValue("Region") == 'North Coast': gp.Delete_management("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp") if row.GetValue("Region") == 'Murray Inland': gp.Delete_management("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Contour.shp") gp.Delete_management("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp") if row.GetValue("Region") == 'South Coast': gp.Delete_management("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp") break row=scursor.Next() del scursor
import sys, string, os, arcgisscripting gp = arcgisscripting.create(9.3) Mooring_Structure = "Mooring_Structure.shp" P_L = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines" Clip_Feature = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Clip_Feature\\Clip_Feature.shp" gp.FeatureClassToFeatureClass_conversion("\\\\Atlas\\data\\geodata\\statelamblands\\moor_struct\\arc", P_L, Mooring_Structure, "") gp.workspace = "C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Clip_Feature" scursor=gp.SearchCursor(Clip_Feature) row=scursor.Next() while row: if row.GetValue("Region") == 'North Coast': if gp.Exists("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp"): gp.Delete_management("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp") if row.GetValue("Region") == 'Murray Inland': if gp.Exists("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Contour.shp"): gp.Delete_management("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Contour.shp") if gp.Exists("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp"): gp.Delete_management("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp") if row.GetValue("Region") == 'South Coast': if gp.Exists("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp"): gp.Delete_management("C:\\Daves_Stuff\\ArcPad_Data\\Standard_Layers\\Lamberts_Projection\\Pts_Lines\\Mooring_Structure.shp") row=scursor.Next() # This line must be indented one level to be inside the while loop. If it is not, the while loop never advances the row and becomes infinte. del scursor
scursor=gp.SearchCursor(Clip) row=scursor.Next() if row.GetValue("Region") <> 'Murray Inland': gp.MakeFeatureLayer("Boatmap_Index.shp", "Boatmap_Index_lyr") del scursor
Hi.
Thanks for your modified code. I am now using this. I have now added more complexity to the IF statement by utilising 'NOT' condition. That is, instead of evaluation if something is present, it is evaluating if something is absent. This is shown is a subsection of my script below. I am finding the IF statement to be quite useful.scursor=gp.SearchCursor(Clip) row=scursor.Next() if row.GetValue("Region") <> 'Murray Inland': gp.MakeFeatureLayer("Boatmap_Index.shp", "Boatmap_Index_lyr") del scursor