POST
|
Use arcpy.SelectLayerByAttribute_management then arcpy.DeleteFeatures_management Code examples are in the help: http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000071000000 http://resources.arcgis.com/en/help/main/10.2/index.html#//001700000036000000 Thanks for the answer again Ipinner... Your tip worked perfectly. The code turned like this: arcpy.SelectLayerByAttribute_management ("GAP", "NEW_SELECTION", " GRIDCODE=1 ") arcpy.DeleteFeatures_management("GAP") Quite easy and everything worked really nice...
... View more
04-17-2014
03:41 AM
|
0
|
0
|
1671
|
POST
|
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. Ok...I'll try. Thanks
... View more
04-11-2014
10:19 AM
|
0
|
0
|
1671
|
POST
|
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. iamurray, thanks for the help. If you could send me the code I would appreciate. I'm new using python in ArcGIS, so every help is welcome. Thanks
... View more
04-11-2014
10:00 AM
|
0
|
0
|
1671
|
POST
|
I'm new here at the Forum and I tried looking for something like my problem, and I got nothing. If there is something, please, forgive me. I have a binary polygon shapefile, with a feature called GRIDCODE with 0s and 1s for earch polygon. I want to edit this shapefile and delete every polygon with the number 1. In other words, I want only the polygons with GRIDCODE number 0 in my shapefile. To do that in Editor mode is quite simple, but I want to do it through a python code. Does anymore here know how to do it? Thanks
... View more
04-11-2014
05:52 AM
|
0
|
6
|
2751
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|