Select to view content in your preferred language

Formula for multiple symbology changes

191
3
12-08-2024 03:58 PM
PipeVision
Emerging Contributor

Hi there!

I have a Point Layer, Which i want to apply a symbology based on two fields.

I think i understand the logic, but am stuck with how the code needs to be written.

Example:
IF Field "SCORE_S" >0 i want to colour the points Blue,
But also, IF "SCORE_S" = 0-10 Size 4pt / 10-29 6pt / 30+ 8pt

AND

IF Field "SCORE_O" >0 Colour Red
Also -  IF "SCORE_O" =  0-10 Size 4pt / 10-29 6pt / 30+ 8pt

Any assistance would be greatly appreciated,
And am happy to find the solution myself, if only i knew what to search for!

Kind Regards,

0 Kudos
3 Replies
DavidPike
MVP Frequent Contributor

probably the best way is to create a new field expression so you can classify the combinations and subsequently change the symbology size and colour interactively in the symbology window.

https://support.esri.com/en-us/knowledge-base/how-to-assign-colored-symbols-to-attributes-using-arca...

If you replace the code from the above with something along the lines of the below.  I'm not entirely sure of the logic that drives the colour changing to red so I've not included that.  Can you elaborate on that?

var score_s = $feature.SCORE_S
var score_o = $feature.SCORE_O

if (score_s > 0 && score_s < 10 && score_o < 0 ) {
    return "Blue 9";
} else if (score_s >= 10  && score_s < 30 && score_o < 0 ) {
    return "Blue 29";
} else if (score_s >= 30 && score_o < 0 ) {
    return "Blue 30+"   
}
0 Kudos
PipeVision
Emerging Contributor

Hi David,
My apologies for the delay.

To clarify my use case,

The points on my map are from a template of data that i will use various subsets of regularly.
The structure of the fields and values will always remain the same.

The points refer to an observation, and the observations are given scores based on their Impact.
OBS_SCORES field is the weight given to the observation to detail its structural integrity 
(0=None - 99=Destroyed)

OBS_SCOREO is a weighted score given based on its impact on operations
(0=None - 99=Absolute failure)

Some other observations within the layer are simple comments, and will have 0 scores in both SCORES & SCOREO. And some observations will have both a structural impact, and an operational impact.

IF an observation is structural, id like it one colour (Red for example), if its Operational, another colour (say, blue)
Now, If its both, i guess i could introduce a third colour.

This will help visually identify the type of observation (Structural of Operational).

THEN, 
Based on the score id like the size of the point on the map to change, to symbolize the severity of the observation.
For example, Comments and observations that have 0 scores, are just there for reference.
However, If a SCORES or SCOREO is an 80, i want it much larger to visually emphasize the severity of that observation.

 

0 Kudos
DavidPike
MVP Frequent Contributor
var score_s = $feature.SCORE_S
var score_o = $feature.SCORE_O

if (score_s > 0 && score_o > 0 ) {
    return "Both";

} else if (score_s > 0  && score_s < 10) {
    return "Structural 9";
} else if (score_s >= 10  && score_s < 30) {
    return "Structural 29";
} else if (score_s >= 30) {
    return "Structural 30+";

} else if (score_o > 0  && score_o < 10) {
    return "Operational 9";
} else if (score_o >= 10  && score_o < 30) {
    return "Operational 29";
} else if (score_o >= 30) {
    return "Operational 30+"

}

I think that should give you an idea of what to add for 'Both' using the above sample.   

0 Kudos