0

I have a polygon shapefile that represents combinations of soil hydrologic type (A,B,C,D) and soil cover (53 different possible covers, coded from 0 to 53). Each of the 53 soil covers can be either soil hydrologic type "A", "B", "C" or "D". Depending on this, each intersection will have assigned a number, i.e. field "CNII". I would like to populate CNII field automatically based on a table that looks like this:

Example of possible combinations

My attribute table containing fields "Cod_Cob" (Integer) and "Clase_Hid" (Text) would need to have "CNII" (Integer) populated as a function of the former two:

Example of needs

I am new to Python parse in the field calculator (I am using Arcmap 10.4.1 with Standard License) but would like help finding a solution using this tool or any other kind you think is appropriate. I checked how to write if else statements and return the values input manually in the code but this doesn't seem adequate because there are more than 200.000 possible combinations for the soil type-soil cover complexes. I have 85 features I need to populate and I can do it manually by now, but I will be needing this solution for bigger projects.

1
  • Welcome to GIS SE! As a new user please take the tour to learn about our focused Q&A format. What have you tried? A good question should include some research and attempt. Please edit your question to show what you've tried, and details of what happens when you try it.
    – Midavalo
    Commented Jun 9, 2017 at 17:05

1 Answer 1

1

One way to do this, although perhaps not the most elegant, Would be to go back to your initial table and re-format it slightly. Instead of having a single row with multiple values for your soil types. Rather format it so that you only have two columns: ID and CN Value. The ID will be you "CoB_CoB" joined with the CN Value. As you have shown in your second table "CN" Field. See an example of a reformatted table below, from the example you have given.

enter image description here

Once you have this, create a Field in your attribute table with a field called "Mod_CN" or something you are happy with. Use the field calculator to join the "Cob_Cob" field and the "Class_Hid" field into an ID identical to the reformatted table. The field calculator expression would be something like:

[Cob_cob] & "_" & [Class_Hid]

You can use this as the linking field in a table join. Join the formated table with your attribute table you wish to include the CN values and copy the CN Values across. Remove the join when you are finished.

You can keep the reformatted table on hand and repeat this methodology for larger datasets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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