Is there a way to stack labels in ArcGIS Online? Example $feature.latitude + "\n" + $feature.longitude The code is excepted but nothing happens.

999
10
07-28-2020 12:07 PM
EdwardHyle
New Contributor II

Is there a way to stack labels in ArcGIS Online? Example $feature.latitude + "\n" + $feature.longitude / The code is excepted but nothing happens. ThanksArcade codeResult

0 Kudos
10 Replies
JoshuaBixby
MVP Esteemed Contributor

You are mixing Python and Arcade.  With Arcade, the newline is (Constants | ArcGIS for Developers )

TextFormatting.NewLine

0 Kudos
EdwardHyle
New Contributor II

Thanks but a little confused. Just got this for ESRI Help.

Esri Customer Care
3:39 PM (41 minutes ago)
to me

Hi Eddie,

Thank you for contacting Esri Support Services. This is Kalle, writing in reference to the case #. I have taken ownership of this issue and will be working with you to reach a resolution. I understand you're unable to stack your labels in ArcGIS Online but they are appearing correctly in the Arcade expression environment.

I've done some research into this and I've found an enhancement that we have logged in relation to this issue. Unfortunately, stacked labels are currently not a supported functionality in ArcGIS Online. While they display correctly in the Arcade expression box the display of the hosted feature layers and maps do not support this type of display. The enhancement is currently under consideration so there is a chance it will be implemented in a future release of ArcGIS Online.

I've gone ahead and attached the enhancement to this case so you're able to follow it's progress in your MyEsri account. Please let me know if you have any follow up questions!


Best,
Kalle
Esri Support Services

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Ah, that could be, i.e., supported in Arcade but not in AGOL.  I answered the question in a general response, which I still think is valid in terms of using TextFormatting.NewLine, but I did not test for AGOL.

UPDATE:  I just tested using the new AGOL map viewer, and stacked labels work using TextFormatting.NewLine.  

0 Kudos
EdwardHyle
New Contributor II

A similar expression using python works great ArcPro and Desktop, anyway thanks for your response. I will wait for the enhancement in AGOL.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I updated my previous comment, I got stacked labels to work in new AGOL map viewer.

Regarding "\n", I forgot that is also JavaScript and since Arcade is closely related to JavaScript, I can't say I am surprised it work.  That said, I think using TextFormatting.NewLine is the documented option and less likely to break in the future.

0 Kudos
RussellRoberts1
Esri Frequent Contributor

mulit line labels are only supported in 4.x JSAPI applications. This includes Map Viewer Beta(author and view them), Experience Builder, Dashboard beta and 4.x template web applications. 

EdwardHyle
New Contributor II

Stacking labels work great using AROL Beta map viewer.

JoshuaBixby
MVP Esteemed Contributor

If your question is answered, which it appears to be, please close out this question/thread.

0 Kudos
SWilander
New Contributor III

 I just tried this and labeling out of the New formerly 'beta' now just "Map Viewer" does NOT work. Topic needs clarification. Can anyone provide more details? Do I need to create the app from the Map viewer (The new normal one NOT the Classic viewer), or can I add it to the App I already created ?What EXACTLY does the usage or syntax look like in the AGOL configuration pop-up interface thing(y)? 

Need specific formatting ?has to be a string or ?has to be a number or???

Here is what I tried that doesnt work today.

SWilander_0-1632761321412.png

 

 

Dont close out the topic its not solved.

0 Kudos