Symbolize layer based on two attributes

899
1
03-27-2023 01:38 PM
janderson_ksninc
Occasional Contributor

I have a layer that the client would like to have symbolized based on two attributes. One attribute to control the shape of the symbol and another to control the color of a symbol. Is this possible?

1 Reply
jcarlson
MVP Esteemed Contributor

Technically yes, but it's tedious to configure. In AGOL, adding more than one attribute to the symbology classes requires that the additional attributes are numeric. The other options are to use a second field to drive transparency and rotation, but nothing for color.

The way to get two fields into your symbology classes is to use an expression that concatenates them.

return $feature.fieldOne + ' | ' + $feature.fieldTwo

But even a few options in each field can turn this into a long list of possible combinations, each of which would need to be opened up and modified manually. No option to just open all the "Oswego" values and change their shape, then adjust the colors separately.

jcarlson_0-1679953471997.png

If you know your way around using the ArcGIS Python API, you could use a couple lists of possible values and populate the map's JSON definition with all the potential combinations.

But no matter which way you do it, the legend is going to look pretty ugly.

A slightly hackier way to accomplish this would be to add the layer to your map twice and put them both in a group layer. Then make one layer big circles with the color, the other solid black shapes.

jcarlson_1-1679953905252.png

Set the shape layer's blending style to Destination In.

jcarlson_2-1679954000099.png

The visual effect is what you want, and the legend looks good:

jcarlson_3-1679954139106.png

Major Caveat: this only works when the features are far enough apart that the shape symbols don't overlap. When points get too close together, you start to see the edges of things.

jcarlson_4-1679954228134.png

 

 

 

- Josh Carlson
Kendall County GIS