4

Does anyone have a trick for assigning polygons a code based on the classification classes?

For example, if I symbolize the population of census blocks with 10 classes using Natural Breaks, I would then like to add a new field to the table where each polygon will assigned a number 1 through 10 that represents the natural break class the polygon fall in. Similar to Reclassify in Spatial Analyst but using a polygon instead of a raster.

  • 1
    Roundabout way but you could convert to raster than reclassify. Alternatively you could use the field calculator. If there are only 10 classes it won't take long – whatahitson Feb 3 '16 at 16:34
  • 2
    Possible duplicate of this question: gis.stackexchange.com/questions/23467/… It seems like a good answer, but there could be a tool built by Esri that I don't know about. – juturna Feb 3 '16 at 16:35
  • Have a look at field calculator expression I've made gis.stackexchange.com/questions/177652/… and use it all the time for exactly the same purpose – FelixIP Feb 3 '16 at 19:30
2

Slightly modified and faster field calculator expression using enumerate to populate new integer field:

breaks=[-67.7,-46.7,-17.1,21,100]
def Get_Class(x):
 for i,v in enumerate(breaks):
  if  v >= x:break
 return i+1

'------------------------------------------

Get_Class(!ROTATION!)
1

Agreeing with whatahitson's answer - use selections and the field calculator. To elaborate: Add a field to the data table of your polygons layer. Since you've already calculated the breaks, then use the Select by Attributes tool under the Selection menu to select the polygons with values in between two breaks.

Then, with these polygons still selected, highlight your new field in the data table and open Field Calculator. Type the classification number in the input box. Repeat the process for all 10 of your classes.

  • Valid solution beside the time it will take for 10 classes – FelixIP Feb 3 '16 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.