I am very new to ArcMap and I am still learning the basics and terms. If I am not explaining things enough please ask me.

This is what I am trying to do: I have a soils dataset and the Soil map units column I am interested in has values like this 'HfD2', 'FaE2', 'SaA', 'SyB' and so on.

I would like to know if it is possible to assign colors based on the range A - E. i.e., if the map units with 'A' all fall into one color category, 'B' into another and so on. The range is A through E, so I know there's only going to be 5 categories.

I am thinking this should be done with a SQL expression but can not figure out how to do the same.

  • You can definitely add categories within the Symbology tab of the Layer Properties window in ArcMap. The thing I don't get though is you want to specify that 'HfD2' becomes 'A' etc. How do your values relate to the A-E range? – Alex Tereshenkov Sep 22 '14 at 17:49
  • @Alex 'HfD2' belongs to Category D. 'FaE2' - Category E 'SaA' - Cateogry A and so on. The third character in the column value has the category, so a SQL expression MapSymbol like '%A%' belongs to Cat A, like '%B%' to Cat B should classify. Thanks! – Aqua267 Sep 22 '14 at 17:56

While I largely agree with @Erica's answer, I would suggest going about it slightly differently. Personally, I would suggest adding a new text field called, for example, "Category". Then, use the field calculator geoprocessing tool or right click on that new field in the attribute table and bring up the field calculator window. (http://resources.arcgis.com/en/help/main/10.1/index.html#//005s00000029000000) Then, as the expression for calculating the value of the new field, you would simply use !FieldName![2] as the calculate expression, replacing FieldName with whatever the field name is for the field that currently has the values like 'HfD2' in it. And make sure the parser in field calculator is set to Pyton.

Using that expression should populate your new field with the A, B, C.... as appropriate, assuming what you said about that always being the 3rd character is correct. And by the way, in case you are not familiar with Python, yes, [2] in the calculate expression is not a miss-type, Python starts counting with 0, so 2 is actually the 3rd character.

Then, once you have a field with the categories in it, you can open up the layer's properties in ArcMap and click on the Symbology Tab > Categories > Unique Values. Then, set the Value field to the new Categories field you just created and populated, and click the "Add All Values" button. Then click on the individual symbols and change colors/symbols as appropriate.

  • Nice improvement on the method :) – Erica Sep 22 '14 at 18:38
  • @John Everything worked nicely except that I found out there were less than 3 characters for a few map units. In those cases I would need to put them in category 'A'. I am googling for python script to add this Or condition but I thought I would ask you as well since you know the context. Again many thanks! – Aqua267 Sep 22 '14 at 19:18
  • Well, I don't know the specifics of your data, but from the few example values you give, it looks like the category value should be the last non-numeric character. Therefore, you could do something along the lines of checking the last character (!Field![-1]) and using it if it's in ['A','B','C'...] but going to the next to last character if the last character's a number. The Using the Like SQL select by statement method in the answer by @Erica may be useful, but you'd want to make sure you have nothing like AbD3 where Like %A% would catch this instead of being in Category D. – John Sep 22 '14 at 19:27

There are a couple possible solutions.

One will be to create a new column (e.g. "Category"), and fill it with the values A-E that relate to the various soils. If there aren't a lot of soil abbreviations and/or rows in the table, this should be pretty straightforward. (Select by Attribute to select all the soil types you want in Category A -- LIKE '%A%' -- then right-click on the "Category" column, and use Field Calculator to set its value to "A".)

Another is to group the symbology itself after symbolizing your polygons using categories. Select all the categories you want to be in the same category, then right-click and select "Group Values" -- repeat for each of your categories. (The label will automatically populate as something like HfD2;FaE2;SaA -- you can change this to simply be A. Details are in the ArcGIS Help Page for Drawing a layer using categories, under Combining Categories.

  • Thanks for your reply. I have about 1 million rows so manual update is ruled out. I did the steps outlined in your Sol 1 and the SQL expression for Category 'A' gave me 300k rows. Will your second option work for this large dataset? Thanks again. – Aqua267 Sep 22 '14 at 18:27
  • @Aqua267, the second option presented there would depend on how many unique values there are in your input data. For example, if all the Category A's are one of just a couple values ex: SaA, SbA, or ScA, then yes, this would be pretty easy to just combine those three in symbology. If there are a lot of unique values though, that would likely be a bit needlessly labor intensive. – John Sep 22 '14 at 18:33
  • @Aqua267 Either works regardless on the dataset size. I'd personally go with the former and repeat it five times -- Field Calculator will work on only that subset of 300k after you've selected. Or use John's suggestion below if the category letter is always the 3rd character of your soil abbreviation string. – Erica Sep 22 '14 at 18:38

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.