Select to view content in your preferred language

Creating an Arcade Expression for Symbology with over 2000 features

775
3
Jump to solution
11-01-2024 08:53 AM
Josh_Rhamy
Emerging Contributor

Greetings,

First time posting a question here but I was hoping for some insight regarding arcade expressions and what seems to be a limitation on the number of features it will categorize for symbology.

The expression works in that it looks at 2 different fields and comes up with different combinations to symbolize. I've also confirmed that I've got every unique combination existing in my dataset by creating temporary features - (tracking that if a specific combination didn't exist in the dataset that it would be skipped on the list of options to symbolize). 

That said - it seems to be only looking through the first 2,000 features before stopping, there for it doesn't capture every unique combination. Our dataset has ~22k features in it but it only returns the first 2000 when applying the expression in the symbology set up.

Any thoughts on how to get around this limitation? That or forcing it to flip the way it reads the table so that it starts at the bottom of the table (therefore capturing all my temporary features and getting each combination.

 

If it helps, I've got the expression below. The idea is that the coded values run 0-3 for both our customer & utility status fields. This symbology would show the status of each side for each combination available:

var RightSide = $feature.custstatus;

var LeftSide = $feature.utilstatus;

Concatenate(LeftSide, ", ",RightSide);

if ((Concatenate(LeftSide, ", ",RightSide))=="1, 1") {

    return "Lead | Lead";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="1, 2") {

    return "Lead | Non-Lead";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="1, 3") {

    return "Lead | Galvanized";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="1, 0") {

    return "Lead | Unknown";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="2, 1") {

    return "Non-Lead | Lead";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="2, 2") {

    return "Non-Lead | Non-Lead";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="2, 3") {

    return "Non-Lead | Galvanized";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="2, 0") {

    return "Non-Lead | Unknown";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="3, 1") {

    return "Galvanized | Lead";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="3, 2") {

    return "Galvanized | Non-Lead";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="3, 3") {

    return "Galvanized | Galvanized";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="3, 0") {

    return "Galvanized | Unknown";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="0, 1") {

    return "Unknown | Lead";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="0, 2") {

    return "Unknown | Non-Lead";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="0, 3") {

    return "Unknown | Galvanized";

} else if ((Concatenate(LeftSide, ", ",RightSide))=="0, 0") {

    return "Unknown | Unknown";

} else {

    return "Other";

}

 

Thanks in advance for any help or insight you can provide & happy mapping!

0 Kudos
1 Solution

Accepted Solutions
Josh_Rhamy
Emerging Contributor

Annnnddd I found a work around. 😅 Leaving it here incase anyone else runs into this issue in the future...

 

I was able to confirm that the arcade expression when determining the symbology groupings was only looking at the first 2k features. If a combination doesn't exist within that subset of the data - it wont show up in the groupings. 

 

The work around was by using filters. We already created a "placeholder" feature for each combination but the problem was that they existed at the bottom of the table instead of the top. In our case we have ID's for each of our features, and our placeholder feature ID's were all listed as "SYMBOLOGY" just to keep things clear. I was able to use this value to work through the issue:

  1. Create a filter to the layer first to look for that unique value - i was able to filter the data down to those unique 16 different combinations.
  2. Save the layer - check data tab to confirm the filter is working correctly
  3. Re-apply expression - confirmed all 16 combinations came in with 1 value each
  4. Coordinate whatever symbols you need. 
  5. Save Layer again
  6. Remove (or in my case invert) the filter so that your data comes in completely and/or hides the SYMBOLOGY placeholder features.
  7. Save one more time

Hope this helps!

 

View solution in original post

3 Replies
KenBuja
MVP Esteemed Contributor

It's frustrating that Arcade won't give you all the symbology for the possibilities in your code without scanning all the records. I have to use dummy values at the beginning of the data to get the legend to build properly.

That being said, you can simplify your code this way

function status(input) {
  Decode(input, 1, "Lead", 2, "Non-Lead", 3, "Galvanized", 0, "Unknown", "NA")
}

var LeftSide = status($feature.custstatus)
var RightSide = status($feature.utilstatus)

if (LeftSide == "NA" || RightSide == "NA") return "Other"  //returns "Other" if either are "NA"
return `${LeftSide} | ${RightSide}`

 

 

Josh_Rhamy
Emerging Contributor

Thanks for the response @KenBuja . Yea lesson learned for sure by adding those features into a layer before loading in the rest of the data. 

Also really appreciate the insight on the more efficient code. Self taught so I usually end up taking a roundabout way to get there. Thanks!

0 Kudos
Josh_Rhamy
Emerging Contributor

Annnnddd I found a work around. 😅 Leaving it here incase anyone else runs into this issue in the future...

 

I was able to confirm that the arcade expression when determining the symbology groupings was only looking at the first 2k features. If a combination doesn't exist within that subset of the data - it wont show up in the groupings. 

 

The work around was by using filters. We already created a "placeholder" feature for each combination but the problem was that they existed at the bottom of the table instead of the top. In our case we have ID's for each of our features, and our placeholder feature ID's were all listed as "SYMBOLOGY" just to keep things clear. I was able to use this value to work through the issue:

  1. Create a filter to the layer first to look for that unique value - i was able to filter the data down to those unique 16 different combinations.
  2. Save the layer - check data tab to confirm the filter is working correctly
  3. Re-apply expression - confirmed all 16 combinations came in with 1 value each
  4. Coordinate whatever symbols you need. 
  5. Save Layer again
  6. Remove (or in my case invert) the filter so that your data comes in completely and/or hides the SYMBOLOGY placeholder features.
  7. Save one more time

Hope this helps!