So....
I have a zoning maps for all the municipality over a tri-county area. I have taken the time to code into the attributes an RGB value and the corresponding HEX code for the appropriate color based off of the APA's Land based Classification scheme this way every R1 zone weather its in muni A or muni Z has the same color. I have around 200 unique features and i really would like to not have to copy and paste my HEX codes into the symbol color picker one at a time.
this is a topic that has come up before but is not resolved satisfactorily in this thread
Set symbol color from RGB values in attribute table
it also is mostly for arc desktop.
In Pro I have the
Attribute-driven color in symbology—ArcGIS Pro | ArcGIS Desktop
which tells me that i must supply "Arcade expression that returns a string. "
all well and good and about as helpful as mud...
Does the string have to be formatted as just R,G,B
Concatenate( "$feature['Units_in_M$.R'] + ", " + $feature['Units_in_M$.G'] + ", " + $feature['Units_in_M$.B'])
or
(R,G,B)
Concatenate( "(" + "$feature['Units_in_M$.R'] + ", " + $feature['Units_in_M$.G'] + ", " + $feature['Units_in_M$.B'] + ")" )
or
rgba(r, g, b,a)
Concatenate( "rgba(" + $feature['Units_in_M$.R'] + "," + $feature['Units_in_M$.G'] + "," + $feature['Units_in_M$.B'] + ",0" +")" )
All of these verify as correct expressions yet none of them change the color of a symbol to the correct color that I am referencing in my attribute table.
I know it says that while the expression may be valid it may not symbolize correctly if the resulting text expression is not a real rgb color. I have also tried the above combinations with just hard coded (255,0,0) which should return red but it does not.
Also
As far as I can tell this may be just as time consuming as inputting the correct color by hand as there does not appear to be a way to apply this code to all 200 features.
Am I missing something?
Please help
Hey ESRI, some real world examples for writing Arcade code would be ideal. I'm not sure many working professionals say "Hmm, I'm going to learn Arcade today instead of working on my deadlines...."
I spent several hours this weekend trying to find the answer for my problem in Arcade. Can discrete point colors not on a color scheme be displayed using Arcade?
If you have only one or a few different symbols, you can go into "format point symbol" (in my case), then click Properties, then layers. Expand Appearance. Click the "database +" icon to the right of color. Select the field that contains your color. Press OK. Click Apply. Repeat for your other symbols.
The implementation of "Vary Symbology by Attribute" is confusing unless it's done symbol by symbol.
I imagine even if I did create an Arcade script to return the color, the color scheme may over-ride the attribute values.
When I am in the format point symbol and have chosen a symbol, and then go to the 3 bars in the upper right and choose "Allow symbol property connections", it would have made more sense to go to "properties">"layers" where I can choose which fields have my color info, versus the "vary symbol by attribute" window, which doesn't have the ability to create discrete colors based on the attribute.
I have a mix of hex values (#FF0000") color names (Green) and RGB values (255,0,255) in my marker_color field. Thankfully, ArcGIS Pro read each color with no difficulties! I didn't have to translate my different formats into one. Thanks! I saw a lot of python and VBscript examples, which I'm glad I didn't have to use.
I recommend:
I'm hoping to be able to vary the symbol itself based on an attribute table. I don't think that's possible yet.
"I'm hoping to be able to vary the symbol itself based on an attribute table. I don't think that's possible yet."
This is currently frustrating me in a pretty big way. I'm currently trying to set three different colors for three different ranges of values from an attribute table. Were you able to figure out if you can use Arcade to vary the symbol by attribute table values? It seems like I will just have to try to set the discrete colors in ArcGIS Online. I hope I can.
This is achievable as well using the attribute driven color approach. What issues are you having?
I'm having the same issue. If field1 <= 2 or field2 <=2 or field3 <=2 show the point as red. If field1=3 or field2=3 or field3=3 show the point as yellow. If field1=4 or field2 =4 or field3 =4 show the point as orange. Show any other point as green. I can't seem to get the expression right in the symbology for the feature class.
Hi Mellor, John ,
Your case is actually different from the one the OP posted. Yours could be solved like this:
var field1 = 4; // point to your field1
var field2 = 3; // point to your field2
var field3 = 2; // point to your field3
var result = "green";
if (field1 <= 2 || field2 <= 2 || field3 <= 2) {
result = "red";
} else if (field1 == 3 || field2 == 3 || field3 == 3) {
result = "yellow";
} else if (field1 == 4 || field2 == 3 || field3 == 3) {
result = "orange";
}
return result;
(shouldn't the yellow and orange assignments be switched, because now you will get red-yellow-orange-green and a more logical color range would be red-orange-yellow-green?)
+1 with same issue.
Similar scenario - I have property zones that I need to colour by the RGB value field.
Running ArcGIS Pro 2.4 Beta 2
Would love to see some examples, sure we can't be far off?
This really does not seem to be working as described in the documentation. Kory Kramer, if you have a moment could you clarify how to make this work?
@XanderBakkerand @KoryKramer was this ever resolved? I am using 2.7 and it still seems to not follow the procedures outlined in the help documentation.
Hi @AdrianWelsh ,
I wrote something explaining the procedure a while ago because it is possible to do this for a couple of versions now.
Let me know if this helps.