Hello,
I have a feature service that is symbolized using bivariate colors for two continuous variables. The grid size is 3x3, so there are nine possible colors on the map (see screen shot). In the pop-up window, I want to provide textual context for the color using an Arcade When() function, but I'm not sure how to do that with this type of symbology. Is it possible to set up a conditional for the pop-up window based off of the colors of the map, rather than the values in a field? General concept below.
When(
featurecolor == 'red', "High Conservation Need",
featurecolor == 'purple', "High Restoration Need",
featurecolor == 'green', "High Protection Need",
featurecolor == nocolor, "No Protection or Restoration Goals"
)
Solved! Go to Solution.
Just tested a little:
In ArcGIS Pro, you can see the class breaks in the field histograms of the symbology pane:
If you publish that layer and view its symbology in MapViewer Classic, it reveals that bivariate symbology actually uses an Arcade expression to symbolize, you can get the values out of that:
You can either use these values in the expression above, or you can just copy/paste the symbology expression into a popup expression. In my case (X and Y values of the geometry's centroid), it looks like this:
Of course, you should probably edit the expression a bit to show more descriptive text...
Can't test with Map Viewer, but there's probably a way to get to the values there, too.
AFAIK, there's no way to access the symbology information. You have to do it yourself:
function categorize(value, thresholds) {
// takes a value and an array of numbers
// returns the array index of the highest number that is less or equal to the value
// categorize(6, [0, 5, 10]) --> 1
if(value == null) { return 0 } // treat empty goal as low
thresholds = Sort(thresholds)
for(var i = Count(thresholds)-1; i >= 0; i--) { // iterate backwards through the array
if(thresholds[i] <= value) {
return i
}
}
}
if($feature.ProtectionGoal == null && $feature.RestorationGoal == null) {
return "No Protection or Restoration Goals"
}
var protection_thresholds = [0, xxx, yyy] // ha
var protection_goal = categorize($feature.ProtectionGoal, protection_thresholds)
var restoration_thresholds = [0, xxx, yyy] // ha
var restoration_goal = categorize($feature.RestorationGoal, restoration_thresholds)
var status = When(
protection_goal == 0 && restoration_goal == 0, "low protection and restoration need",
protection_goal == 1 && restoration_goal == 0, "medium protection need",
protection_goal == 2 && restoration_goal == 0, "high protection need",
protection_goal == 0 && restoration_goal == 1, "medium restoration need",
protection_goal == 1 && restoration_goal == 1, "bla",
protection_goal == 2 && restoration_goal == 1, "bla",
protection_goal == 0 && restoration_goal == 2, "bla",
protection_goal == 1 && restoration_goal == 2, "bla",
protection_goal == 2 && restoration_goal == 2, "bla",
"uncategorized"
)
return status
Thank you Johannes!
That's a bummer, but I sort of expected that outcome. Now I just have to figure out how to calculate the breaks when using a geometric interval. I was lookinig on the data classification methods site, and did not see the algorithm for Geometric intervals, hence why it'd be a lot easier if we could base the conditionals off of the intervals that were already created and symbolized.
Just tested a little:
In ArcGIS Pro, you can see the class breaks in the field histograms of the symbology pane:
If you publish that layer and view its symbology in MapViewer Classic, it reveals that bivariate symbology actually uses an Arcade expression to symbolize, you can get the values out of that:
You can either use these values in the expression above, or you can just copy/paste the symbology expression into a popup expression. In my case (X and Y values of the geometry's centroid), it looks like this:
Of course, you should probably edit the expression a bit to show more descriptive text...
Can't test with Map Viewer, but there's probably a way to get to the values there, too.
Thank you Johannes! That's very helpful. I'll try that out.