2

I have a shapefile with 10 different values (geological ages) which I want to combine into four values (into broader age categories).

Is there a tool which I can use to selectively combine values in ArcMap?

  • Is this just for display or do you actually want to change your data? – PolyGeo Jan 31 '17 at 7:11
  • You can use Field Calculator. Add a new field first to hold the broader categories and then use Field Calculator on these with Python if statements in the code block. Have a look at the code block documentation desktop.arcgis.com/en/arcmap/10.3/manage-data/tables/… – Clubdebambos Feb 1 '17 at 7:35
2

Add a new text field to the data. Enter an edit session for the data. In ArcMap open the attribute table and right-click on the field name for the new field and select Field Calculator. Choose Python as the Parser and check on Show Codeblock.

enter image description here

In the Pre-Logic Script Code: use the following code.

def re_age(old_age):
 if old_age in ["Age1", "Age2"]:
  return "Broader Age 1"
 elif old_age in ["Age3", "Age4"]:
  return "Broader Age 2"
 elif old_age in ["Age5"]:
  return "Broader Age 3"

You need to change what is in between the square brackets [ ] with the 10 ages you want to reclassify. Add more elif if needed. Also change the "Broader Age 1" etc to what you want the new broader group to be named.

Below the code block put in

re_age()

Click in the parentheses and select your field from the Fields list by double clicking on it.

so it should look something like

re_age(!geol_age!)

See image.

Click OK. Save your edits.

Note: you can use Field Calculator outside and edit session but you cannot rollback if you make a mistake, so its good practice to use in an edit session.

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.