Select to view content in your preferred language

Combine legend items in ArcGIS Online?

4016
8
08-03-2022 04:42 PM
AdrianWelsh
MVP Honored Contributor

I made a simple map in ArcGIS Pro 3.0 where my one layer has combined, or grouped, symbology, like this:

AdrianWelsh_0-1659569630720.png

 

There are only five classes yet that green class at the bottom is a combination of seven items. In Pro, this works normal and as expected. 

Once it gets to ArcGIS Online, the legend spaces itself out, like this:

AdrianWelsh_1-1659569799033.png

 

How can I combine these in AGOL so it doesn't look spread out?

Or is that not an option? It looks the same as this in the dashboard in which is it being shown. 

One interesting thing is that in the Map Viewer Classic, they get combined in the legend:

AdrianWelsh_2-1659569902789.png

 

But, if I go to edit my symbology in Map Viewer Classic, they get ungrouped again:

AdrianWelsh_3-1659569992506.png

 

8 Replies
ZorbaConlen1
Frequent Contributor

I just stumbled on this as well. It appears to be a bug with the new map viewer. 

Also, confirmed that the bug impacts Experience Builder apps. At least the one I tested which is the Public Information template.

SupriyaK
Regular Contributor

I also experienced this issue in the new map viewer. This issue doesn't happen in the classic map viewer.

0 Kudos
ArtRod_ODF
Occasional Contributor

Experiencing this same issue: grouped symbology are being separated in the Map Viewer, AND in the web service when added to Pro. Group remains when viewing in Map Viewer Classic. I can save a lyrx file from the web service, with the symbology "re-grouped" and that seems to work.

0 Kudos
SupriyaK
Regular Contributor
ArtRod_ODF
Occasional Contributor

While this bug is being looked into, the work around I used was a fairly simple Arcade expression using "Decode", which allowed me to identify the attribute values and "code" them with the legend output I wanted. This worked well for me as I only had ~10 possible attribute values going into 7 different codes.

0 Kudos
AdrianWelsh
MVP Honored Contributor

@ArtRod_ODF  Can you share your arcade code where you used decode?

0 Kudos
ArtRod_ODF
Occasional Contributor

This is the exact expression I used, in the "Set an expression" button in the Symbology pane in Pro. This pulled in my potential values from a field, and then output them into the groups I wanted for the symbology.

Decode(Left($feature.ELCODE,2), "KP", "Algae/Lichen", "NA", "Algae/Lichen", "NL", "Algae/Lichen", "AA", "Amphibian", "AB", "Bird", "AF", "Fish", "NF", "Fungus", "IA", "Invertebrate", "IC", "Invertebrate", "II", "Invertebrate", "IL", "Invertebrate", "IM", "Invertebrate", "IP", "Invertebrate", "AM", "Mammal", "NB", "Plant", "PD", "Plant", "PG", "Plant", "PM", "Plant", "PP", "Plant", "AR", "Reptile", "Other")

For my use, I wanted to symbolize on the first two characters of the ELCODE field, which is where this part of the expression comes from: Left($feature.ELCODE,2)

Decode works off a list made up of first the value from the field being examined, and then the output that matches it (kind of like a simplified If/Then statement). In my case, for the values "KP", "NA", and "NL" all return the same "Algae/Lichen" value, which essentially groups those input values in the symbology class. Note you also need one last output value, which gets returned if the input value doesn't match any of the possibilities. Since they all get grouped from the Arcade expression, it then symbolizes correctly within the service in both AGOL map viewers, and when added into Pro.

More info on Decode here - 

https://developers.arcgis.com/arcade/function-reference/logical_functions/#decode

ZachBodenner
MVP Regular Contributor

Thank you so much for figuring this out. I've been dealing with it for forever as well, and even after troubleshooting it with an ESRI tech their best advice was to just add a new field for symbology and manually group categories. Neither of us came across this particular thread beforehand I guess. 

Happy mapping,
- Zach
0 Kudos