Select to view content in your preferred language

# Calculate field with RGB color value from symbology?

486
2
06-13-2023 07:59 AM
New Contributor II

I'm in Pro 2.9.  I have a bathymetry layer that has multiple lakes.  Some lakes are very shallow and some are pretty deep.  If I use a color ramp to symbolize using unique values (2 columns, watername and depth), the deep lakes symbolize spanning the whole color ramp but the shallow ones symbolize only using the first part of the color ramp.  I need each individual waterbody to span the color ramp (light blue to dark blue).

example:  Morris Lake goes from 1 - 80.  Leigh Lake goes from 1 - 4.  Both are in the same featureclass.  If I apply a color ramp (light blue to dark blue) Morris Lake will have a nice gradient, while Leigh Lake will be all light blue.

EDIT:  We can get around this part by choosing graduated color, geometric interval instead of unique values.  My coworker pointed that out (I felt stupid) and it works for what I need in the short term.  Each lake won't span the whole color ramp but there should be enough difference between colors/depths for each lake.

I want to be able to loop through the layer, for each watername, apply the color ramp, get the values assigned to each depth and write those hex values to a column.  This is beyond my programming skill and I'm coming up empty using my usual 'google the heck out of it' method.  I can do all this manually, but want a automated fix.

I'm willing to use a definition query, symbolize each lake individually, but i'd still like to be able to pull the colors assigned and write them somewhere so I don't have to do this all over again in the future.

Any help or guidance would be appreciated.

Thanks.

MORE EDITS:  CIM seems to be the way to go.  Thanks for that suggestion.  Let's just say I had 80 featureclasses that all had the same color ramp applied using UNIQUE VALUES.  All those lakes would span from light blue to dark blue.  I want to be able to pull the color assigned in the fc for each value and write it to a column.

2 Replies
MVP Regular Contributor

I'm not entirely sure what you're going for, but check out Python CIM access—ArcGIS Pro | Documentation

You could also do either gradient fills, or multiple layers of donut?

This was pretty quick to set up and easy enough to adjust

 4 Layers of donut each donut layer is twice the size of the one before it (4>8>16>32), and at an increasing transparency of the same brighter color than the base color.

New Contributor II

CIM seems to be the way to go.  Thanks for the suggestion.  I'm not a programmer but I can 'borrow' code with the best of them.  I'll be investigating.  Anybody who has an example or can point me to good examples will be my hero.  Thanks.