So I am writing (trying) Arcade code for ArcGIS Online Web Map that will create a hyperlink in a pop-up of one feature layer, which when clicked, will turn on another feature layer in the same map.
I have two layers:
- Layer A (the layer with the pop-up)
- Layer B (the layer to be turned on)
I'm trying to use ArcGIS Online's URL scheme for layer visibility through the URL parameters. Layer A and Layer B each have IDs from their AGOL web pages I have copied.
Here is my code:
var orgUrl = "https://www.arcgis.com";
// Define the Web Map ID
var webMapId = "0b0c9d09e20a4c1fb6707a51c5e2bd51";
// Define the Layer B ID
var layerBId = "0b0c9d09e20a4c1fb6707a51c5e2bd51";
// Construct the URL with parameters to turn on Layer B
var layerBUrl = orgUrl + "/home/webmap/viewer.html?webmap=" + webMapId + "&layers=" + layerBId;
// Define the hyperlink text
var hyperlinkText = "Turn on Layer B";
// Return the HTML code for the hyperlink
return "<a href='" + layerBUrl + "' target='_blank'>" + hyperlinkText + "</a>";
What I get is a hyperlink that opens a new web map. I'm just trying to create a hyperlink in a feature layer's pop-up that turns on a different feature layer in the same map.
Any assistance would be greatly appreciated. Thank you.