AGOL cannot display labels with custom Arcade formatting

318
3
Jump to solution
08-20-2020 01:24 PM
ChaseMusgrove1
New Contributor II

I'm having trouble getting custom arcade scripts to display correctly on AGOL - on the Beta Viewer or not. I'm wondering what I'm missing or if this capability has indeed not been implemented in AGOL. My goal is to display airport signage like the below. Attached is what signage looks like on AGOL currently when published as a web map from ArcGIS Pro.

agol-style‌ agol issue‌ arcade script # arcade script # custom labeling‌ annotation‌ arcgis pro 2.6‌

0 Kudos
1 Solution

Accepted Solutions
ChaseMusgrove1
New Contributor II

Update as of 8/25:  There is a limitation in that AGOL cannot understand HTML tags in Arcade at this time.

BUG-000122378: ArcGIS Online does not honor Arcade expressions with text formatting tags when configuring labels and pop-ups

According to Paige Yager‌, my ESRI Support Services rep, below is an abridged response to the issue:

HTML tags can be used in pop-ups for this sort of styling, but as far as label expressions go, we are limited to the styling options within label classes. For text. properties such as color, font and halo are currently supported with the ArcGIS API for Javascript 4x (used in Map Viewer Beta). You can find the  Map Viewer Beta offers the capability of adding multiple label classes for different configurations. This way, you can define an Arcade expression to filter the features you're interested in for each class.

Web AppBuilder or other applications using the ArcGIS API for JavaScript 3.x will still be able to consume maps created using the Beta Map Viewer. However, multi-line labels are not supported in the 3.x API and therefore will not be honored. After a quick test on my end, the multi-line labels are combined into a single line when using Web AppBuilder. More information on this can be found in these resources: 

TextFormatting.NewLine documentation on the multi-line function

The only workaround that I've found is converting Arcade labels to annotations and then to features. The feature conversion process uses the Feature Outline Mask and Erase tools to preserve the background and text at a specified size like annotations. As features, AGOL will be able to consume these pseudo-labels. It's an extensive workaround and no doubt would benefit from some automation (in Python), however, it works.

View solution in original post

0 Kudos
3 Replies
KenBuja
MVP Honored Contributor

Do the fields that you're displaying contain special characters (& or <)? If so, these have to be replaced with their equivalent character codes (&amp; and &lt;) like this when using formatting tags:

"<BOL>" + replace($feature.Notes, "&", "&amp;") + "</BOL>"‍
0 Kudos
ChaseMusgrove1
New Contributor II

Hi Ken,

I'm working with ESRI Tech Support on the issue. It's more complex than a simple symbol replacement. I was under the impression that the Arcade written and working in ArcGIS Pro should work on AGOL. I've learned through ESRI Support that Web Map Viewer Beta perhaps should be able handle it since its introduction of multi-line labeling ability. Nevertheless, it's also possible that my script is too advanced for the current version of JS on AGOL (Beta or not) despite it being interpreted correctly in ArcGIS Pro. My script is based off the Airports Extension layer for airport signage that was originally intended to manage annotations. I discovered it worked for labeling too. I know annotations are not a feature that AGOL can currently handle.

0 Kudos
ChaseMusgrove1
New Contributor II

Update as of 8/25:  There is a limitation in that AGOL cannot understand HTML tags in Arcade at this time.

BUG-000122378: ArcGIS Online does not honor Arcade expressions with text formatting tags when configuring labels and pop-ups

According to Paige Yager‌, my ESRI Support Services rep, below is an abridged response to the issue:

HTML tags can be used in pop-ups for this sort of styling, but as far as label expressions go, we are limited to the styling options within label classes. For text. properties such as color, font and halo are currently supported with the ArcGIS API for Javascript 4x (used in Map Viewer Beta). You can find the  Map Viewer Beta offers the capability of adding multiple label classes for different configurations. This way, you can define an Arcade expression to filter the features you're interested in for each class.

Web AppBuilder or other applications using the ArcGIS API for JavaScript 3.x will still be able to consume maps created using the Beta Map Viewer. However, multi-line labels are not supported in the 3.x API and therefore will not be honored. After a quick test on my end, the multi-line labels are combined into a single line when using Web AppBuilder. More information on this can be found in these resources: 

TextFormatting.NewLine documentation on the multi-line function

The only workaround that I've found is converting Arcade labels to annotations and then to features. The feature conversion process uses the Feature Outline Mask and Erase tools to preserve the background and text at a specified size like annotations. As features, AGOL will be able to consume these pseudo-labels. It's an extensive workaround and no doubt would benefit from some automation (in Python), however, it works.

View solution in original post

0 Kudos