I have a large shapefile (saleArea.shp) which includes hundreds of small adjacent polygons. I would like to dissolve the polygons based on some conditions from tValues
field into 5 bigger groups like
1- "tValues" <= 0.151560
2- "tValues" >= 0.151561 AND "tValues" <= 0.254022
3- "tValues" >= 0.254023 AND "tValues" <= 0.379095
4- "tValues" >= 0.379096 AND "tValues" <= 0.540042
5- "tValues" >= 0.540043 AND "tValues" <= 0.846651
I did this manually by using Select By Attribute
for each of the groups then export them as a new shapefile. After that, I used the Dissolve
tool on each of the layers and eventually merged all the dissolved layers - which was tedious work (Besides I have more than 50 shapefiles and I must repeat this for all!). Can you please let me now how to do this is by Arcpy?
Update
I tried to do this as PolyGeo commented by using the Python parser
if ("tValues" <= 0.151560):
return 1
elif ("tValues" >= 0.151561 AND "tValues" <= 0.254022):
return 2
elif ("tValues" >= 0.254023 AND "tValues" <= 0.379095):
return 3
elif ("tValues" >= 0.379096 AND "tValues" <= 0.540042):
return 4
elif ("tValues" >= 0.540043 AND "tValues" <= 0.846651):
return 5
but I am getting this error