Select to view content in your preferred language

Using Arcade to define symbology

193
4
Jump to solution
07-23-2024 05:24 AM
RobertBorchert
Frequent Contributor III

I have a set of features that need to be defined by 4 attribute and each has 4 possible values. however this generates 256 possible options. 

 

This will allow me to determine Site Not Started, Site in Progress, Site Complete, and Repeater only not started

 

This code works to give me all of the sites that are not started.

Var not1 = ($FEATURE.ANTENNAREPLACED == 'NS' &  $FEATURE.BREAKERREPLACED == 'NA' &  $FEATURE.SNMPUPDATED == 'NA' &  $FEATURE.REPEATER == 'NS')

Var not2 = ($FEATURE.ANTENNAREPLACED == 'NA' &  $FEATURE.BREAKERREPLACED == 'NS' &  $FEATURE.SNMPUPDATED == 'NA' &  $FEATURE.REPEATER == 'NS')

Var not3 = ($FEATURE.ANTENNAREPLACED == 'NS' &  $FEATURE.BREAKERREPLACED == 'NS' &  $FEATURE.SNMPUPDATED == 'NA' &  $FEATURE.REPEATER == 'NS')

Var not4 = ($FEATURE.ANTENNAREPLACED == 'NA' &  $FEATURE.BREAKERREPLACED == 'NA' &  $FEATURE.SNMPUPDATED == 'NS' &  $FEATURE.REPEATER == 'NS')

Var not5 = ($FEATURE.ANTENNAREPLACED == 'NS' &  $FEATURE.BREAKERREPLACED == 'NA' &  $FEATURE.SNMPUPDATED == 'NS' &  $FEATURE.REPEATER == 'NS')

Var not6 = ($FEATURE.ANTENNAREPLACED == 'NA' &  $FEATURE.BREAKERREPLACED == 'NS' &  $FEATURE.SNMPUPDATED == 'NS' &  $FEATURE.REPEATER == 'NS')

Var not7 = ($FEATURE.ANTENNAREPLACED == 'NS' &  $FEATURE.BREAKERREPLACED == 'NS' &  $FEATURE.SNMPUPDATED == 'NS' &  $FEATURE.REPEATER == 'NS')

 

return not1 + not2 + not3 + not4 + not5 + not6 +not7

This code will result in all sites with only a repeater

VAR REPEATER = ($feature.ANTENNAREPLACED == 'NA' & $feature.BREAKERREPLACED == 'NA' & $feature.SNMPUPDATED == 'NA' &  $feature.REPEATER == 'NS')

However, I need to figure out how to get it to create more than one symbol class

I tried 

return with a semi colon in between the final variable

 

0 Kudos
1 Solution

Accepted Solutions
RobertBorchert
Frequent Contributor III

I got it to work using an array.  

var MainFieldArray = [repeater, notall]

where repeater and notall are Variables that are defined

View solution in original post

0 Kudos
4 Replies
jcarlson
MVP Esteemed Contributor

Setting symbology to an expression is similar to setting it to a field: the classes generatetd will be based on the existing values in the table. If the value "A" isn't present in the table, there's no reason to expect the program to intuit it as a potential symbol category.

The direct solution is tedious: create the other symbol categories manually.

As an alternative approach, I'm curious how the different attributes are being used in your symbology. Do you intend one field to define the color, another the shape, and so on? Could you have four separate layers to convey each attribute separately?

- Josh Carlson
Kendall County GIS
0 Kudos
RobertBorchert
Frequent Contributor III

I need four symbol classes

Site Not Started, Site in Progress, Site Complete, and Repeater only not started

Before coming here I did generate all 256 combinations in symbology and then grouped them into 4 symbol classes.  However, publishing them to a feature service did not work

 

0 Kudos
jcarlson
MVP Esteemed Contributor

Okay, I think I'm getting it. Still not totally sure I understand the expression itself, but I see what you're going for. You should take a look at the function When, which allows you to define complex conditions, then return specific values when they evaluate to "true".

return When(
  $feature.ANTENNAREPLACED == 'NA' && $feature.BREAKERREPLACED == 'NA' && $feature.SNMPUPDATED == 'NA' && $feature.REPEATER == 'NS', 'REPEATER',
  some other condition, 'some other value',
  another condition, 'another value',
  'default value'
)

 

- Josh Carlson
Kendall County GIS
0 Kudos
RobertBorchert
Frequent Contributor III

I got it to work using an array.  

var MainFieldArray = [repeater, notall]

where repeater and notall are Variables that are defined

0 Kudos