I am trying to display pavement condition inventory scores as groups, for instance 60-75 is okay, 76-89 is good, and 90-99 is excellent. I can do that in Map, but not Online. There is no grouping setting I can find. You can use Counts and Amounts and set the manual breaks, but you can't change individual colors in the ramp. I am not good with Arcade, but I found something that partially works. The problem is it only returns 3 categories. That may be all it is designed to do. Does anyone have any suggestions? Thanks!
if($feature.PCI >=90){
return "Great"
}
if (75<= $feature.PCI <90){
return "Better"
}
if (60<= $feature.PCI <75){
return "Okay"
}
if(40<= $feature.PCI <60){
return "Bad"
}
if($feature.PCI <40){
return "Awful"
}
Solved! Go to Solution.
Have a look at the expression below. You returned the dictionary, but you need to retrieve the color group from the dictionary based on an attribute of the feature:
// create the dictionary
var dct = {'Bollard': 'Red','Residential Mailbox': 'Red',
'USPS Mailbox': 'Red','Sidewalk Shed': 'Red',
'Sign': 'Red','Transit Elevated Structure': 'Red',
'Building Vault':'Blue','Catch Basin':'Blue',
'Survey Monuments':'Blue','Utility Access':'Blue',
'Transit Subway Vent':'Blue',
'Pedestrian Walkway':'Purple','Steps':'Purple',
'Trees':'Purple','Wall':'Purple',
'Fence':'Purple','Landscape':'Purple','Other':'Purple',
'No obstacle in travel path':'Green'};
// read out the value of the feature from the attribute
var yourvalue = $feature["NameOfTheField"];
// have a result when the value is not in the dictionary or is null
var colorgroup = "Unknown";
// check if the value is in the dictionary
if (HasKey(dct, yourvalue)) {
// the atribute is in the dictionary
colorgroup = dct[yourvalue];
}
// return the resulting color group (not he dictionary)
return colorgroup;
I have a similar issue I'm trying to resolve. I have a single attribution field that has 1 of 5 values. (Excellent, Good, Fair, Poor, Other).
I want to symbolize using 'unique' symbols, but I want to group the 'Excellent' and 'Good' values and leave the rest as they are. I am using AGOL map viewer and trying to write an expression that will resolve it.
I have used the below code, but when i go from the expression window back to my map I keep getting a warning widow stating 'The expression must return a number value'.
Thanks for any assistance!
********Code Below***********
if ( $feature["OPI_RATING"] == "EXCELLENT") {
return "Good";
}
else if ( $feature["OPI_RATING"] == "GOOD") {
return "Good";
}
else if ( $feature["OPI_RATING"] == "FAIR") {
return "Fair";
}
else if ( $feature["OPI_RATING"] == "POOR") {
return "Poor";
}
else if ( $feature["OPI_RATING"] == "OTHER") {
return "Other";
}
else {
return "No Values";
}
Hi Ursu_Lacramioara,
Thank you for your response. However, I am unable to see your solution.
All I see is the reference to an image (i think) that appears as plain text.
[cid:image001.jpg@01d82e4a.ca719a90]
Do you mind trying to repost?
Thank you again for your help.