I’ve been using ArcGIS Pro for several years now and strangely, I only recently learned about a quite cool capability of creating symbology based on colors that are stored as attributes (i.e. either as RGB values, HEX color codes or CMYK).
After spending an hour trawling through the Geonet Forums I saw a few threads where people were discussing this, however I was unable to find a defined process for setting this symbology up. The documentation doesn’t seem to contain it either, so I decided to quickly summarize the workflow in a quick blog post.
So, the situation that we’re going to be looking at is this:
A local council have their zoning polygons imported from MapInfo and they have three attribute fields (as below) – each storing a color (either Red, Green or Blue). Each zoning code must have a specific color used in the map to depict it, so we’re going to use these attributes to create symbology in ArcGIS Pro 2.5.
Step 1: Firstly, we need to create a new text (STRING) field:
Add a field in the Fields Designer or use a geoprocessing tool Add Field.
If you’re using the Field Designer in Pro, don’t forget to save your changes:
Step 2: Calculate the field values. In my example, I will be using Python. You can also create an expression using Arcade. Some examples are given in this Geonet thread: https://community.esri.com/thread/216350-set-symbol-color-from-rgb-values-in-attribute-table-with-ar...
In my case, I used the following expression: "rgb("+str(!RED!)+", "+str(!GREEN!)+", "+str(!BLUE!)+")"
The output in the new color field should look like the following:
Other examples of how the color can be defined in that text field are given here: https://pro.arcgis.com/en/pro-app/help/mapping/layer-properties/attribute-driven-color-in-symbology....
Step 3: Now, the interesting stuff. Setup the attribute-driven symbology
Enable the attribute-driven symbology (based on the combined RGB values). Unless you have a subtype field defined in the feature class, your starting point will be something similar to this:
The layer in the Map will show the colors that will be read directly from the attribute table. However, there’s one problem. Even though the map will show the colors from the attribute table (stored as RGB, HEX or CMYK), the layer on the contents pain will still be showing <all other values>. You won’t be able to automatically create a legend or publish this straight to AGOL.
Our tech. support people investigated this, and this seems to be an issue that had been logged as the following bug: BUG-000104316: Attribute-driven symbology assigned to features is not reflected in the legend information for the feature layer
Hope it’s going to get addressed! In the meantime, hope the above is helpful. Please feel free to reach out if you have any questions or comments. Happy mapping!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.