I'm attempting to use javascript in ArcGIS Online's popup in the mapviewer and am having some issues with getting a function to stick with it.
I have added a LiveFeed layer, NOAA_METAR_current_wind_speed_direction from the MapServer. However, the Wind Speed is displayed in km/h and I would like convert it to mph.
However, I've been unsuccessful in getting a function for converting the data to work. What ultimately happens is that when I 'ok' the script in the Custom Attribute Display, nothing will happen, and when I reopen to check the script - it has disappeared.
I've attempted to enter a simple divide function, tried closing the function in <script> </script>, etc and it all disappears when I reopen the Custom Attribute Display. I'm almost thinking that AGOL doesn't allow you to apply conversions to the data.
If anyone has advice on how to convert km/h to mph successfully, it would be greatly appreciated.
If further clarification is needed, please let me know.
Thank you
Solved! Go to Solution.
Amber Cline - Yes! They recently added this capability for Javascript logic to popups.
Configure pop-ups—ArcGIS Online Help | ArcGIS
Arcade in Popup ArcGIS Arcade | ArcGIS for Developers
Let us know if this works!
I use this now to swap internal links to external URLs with the Replace function to change text in a string of a field, as another example. It's sweet.
Amber Cline - Yes! They recently added this capability for Javascript logic to popups.
Configure pop-ups—ArcGIS Online Help | ArcGIS
Arcade in Popup ArcGIS Arcade | ArcGIS for Developers
Let us know if this works!
I use this now to swap internal links to external URLs with the Replace function to change text in a string of a field, as another example. It's sweet.
Using Arcade will be your best method to covert the windspeed using attribute expressions. Here is the html that is supported through the html editor in pop ups:
Supported HTML—ArcGIS Online Help | ArcGIS
-Kelly