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
- Highlight the layer under Contents (1 in the graphic that follows)
- Click Symbology (2)
- The Symbology Pane will open (3)
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:
- Symbolise with Unique Value, remove all of the symbols listed
- Check the Allow symbol property connections option under the Vary symbology by attribute tab
- Return to the Primary Symbology tab, click the More drop down and select Show All Other Values.
- In the Classes section, right click on the <all other values> value and then select Format Symbol(s) (double-click on the colored rectangle)
- Go to Properties (#1 on the screenshot below) > Layers (2), then select the fill symbol (3).
- Under Appearance, select the database icon (4) to define the attribute to map, and select Color (5) or whatever you named that text field with the combined RGB colors.
- Click ok then apply changes.
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
https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDEwNDMxNg==
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!