Use arcpy.SelectLayerByAttribute_management then arcpy.DeleteFeatures_managementCode examples are in the help:http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000071000000http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000036000000
import arcpy from arcpy import env env.workspace = #"put the file path to the folder your shapefile is in here as a string" cursor = arcpy.da.UpdateCursor(#"shapefile name" , "Field name that has the 1's and 0's") for row in cursor: if row[0] == 1: cursor.deleteRow() del row del cursor I'd make a copy of your shapefile first to test this on, there is no way to undo the delete row, so I would test it on the copy before applying it to the actual file.
import arcpy from arcpy import env env.workspace = #"put the file path to the folder your shapefile is in here as a string" cursor = arcpy.da.UpdateCursor(#"shapefile name" , "Field name that has the 1's and 0's") for row in cursor: if row[0] == 1: cursor.deleteRow() del row del cursor
I'd probably use an update cursor to evaluate the value of the field, then delete the row if it the field value equals 1. If you need some starter code let me know.
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.