I am working within ArcGIS Online to create a web map. I am trying to remove some labels that have duplicate labels to only show one. I have two fields that I am labelling. One is called "Location" and the other is called "Location Description". The purpose of using both is mainly to differentiate between points that are close together. An example of this could be: "Harlem, South" for one point and "Harlem, North" for another.
For points that are isolated, they show both labels that are often identical (only one is needed). An example of this is: "MISSISSIPPI River, Mississippi river"
Is there a arcade expression to show both Location and Location Description where points are close together and have different field values but only show Location when both are the same. One issue is that often, one label is in caps and the other is not, so it is not exactly identical. Is there a work around for this?
The code I have tried so far is:
if($feature.Location == $Location_Description){
return $feature.Location
}
else{
return $feature.Location + TextFormatting.NewLine + $feature.Location_Description
}