I am trying to take an existing shapefile and narrow down the attributes using the 'select by attribute' The problem I am trying to solve is: Find parcels that have an acreage >= 100. The code I have is not narrowing down the search or showing up in arcmap. Below is the code I have so far.
import arcpy#Get Parcel layercountyParcels = "C:\\Users\\Krystle\\Desktop\\WCGIS\\Geog485 \\final\\TarrantCoParcels\Parcels2013.shp"nameField = "TAXPIN"try: #Make a feature layer of parcels2013 arcpy.MakeFeatureLayer_management(countyParcels, "AllParcelsLayer")except: print "Could not create feature layer"try: #Create a seach cursor rows = arcpy.SearchCursor("AllParcelsLayer") #Call SearchCursor.next() to read the first row rows = rows.next() #Start a loop that will exit when there are no more rows available while row: arcpy.SelectLayerByAttribute_management("AllParcelsLayer", '"CALCULATED" >=100.00') #Print vaules in the current row print row.getValue(nameField) #Call SearchCursor.next() to move to the next row row = rows.next() #Clean up cursor and row objects del row del rows #Write the selected features to a new featureclass arcpy.CopyFeatures_management("AllParcelsLayer", "parcels_100plus")except: print arcpy.GetMessages()
أكثر...
import arcpy#Get Parcel layercountyParcels = "C:\\Users\\Krystle\\Desktop\\WCGIS\\Geog485 \\final\\TarrantCoParcels\Parcels2013.shp"nameField = "TAXPIN"try: #Make a feature layer of parcels2013 arcpy.MakeFeatureLayer_management(countyParcels, "AllParcelsLayer")except: print "Could not create feature layer"try: #Create a seach cursor rows = arcpy.SearchCursor("AllParcelsLayer") #Call SearchCursor.next() to read the first row rows = rows.next() #Start a loop that will exit when there are no more rows available while row: arcpy.SelectLayerByAttribute_management("AllParcelsLayer", '"CALCULATED" >=100.00') #Print vaules in the current row print row.getValue(nameField) #Call SearchCursor.next() to move to the next row row = rows.next() #Clean up cursor and row objects del row del rows #Write the selected features to a new featureclass arcpy.CopyFeatures_management("AllParcelsLayer", "parcels_100plus")except: print arcpy.GetMessages()
أكثر...