Select to view content in your preferred language

Add Option in Map Pop-up to Turn on Another Layer

172
2
3 weeks ago
Labels (1)
MHO_Harbors
Occasional Contributor

I'm working with an Experience Builder app that includes a map with two main layers:

  1. HC_footprints_... – a polygon layer containing various construction project records

  2. Georeferenced Imagery – a group layer that includes georeferenced PDFs and CAD files, including one specific PDF titled PDF_SK_1G...

What I’m trying to do:

When a user clicks on a specific polygon in the HC_footprints_... layer, a pop-up appears. Within that pop-up, I want to add a button (or similar option) that, when clicked, will turn on the corresponding PDF layer from the Georeferenced Imagery group layer.

If I cannot do it in a pop-up I believe it can be accomplished with a List, Button, or Feature widget, but I cannot figure out how to link everything.

Screenshot 2025-04-16 155848.png

For example, in the image above, I’ve clicked on a project titled HC from the HC_footprints_... layer. I want a button or interactive element in the pop-up that will automatically turn on the PDF_SK_1G... layer so the user doesn’t need to manually go into the Contents panel to find and toggle it. Like I said above, if a popup cannot be used, how can I set up a list or a button widget to it?

This would streamline the user experience by allowing direct control of the PDF visibility from the pop-up itself.

I cannot figure out if I need to build something into the Pop-up window in Map Viewer or if there is a widget in Experience Builder that will do this. The Embed option just opens the PDF in a new window but does not turn the PDF on.

Any assistance would be appreciated. Thank you.

0 Kudos
2 Replies
AndreLoerch
Occasional Contributor

You definitely can create a custom popup widget to do this. Generally speaking, you'd want to create a popup widget that:

  1. Reads in the default popup template that's set on you feature layers
  2. Create a popup template action with the 'button' type
  3. Attach the button id to a function that does what you want (i.e. takes the layer id of a layer you want to be made visible, and sets the layer visibility to true)

I've done similar work creating custom popups with custom buttons/actions that do several other things (not setting layer visibility) but I'm 100% confident it can be done. The one drawback is that IMHO creating custom popup widgets for Experience Builder is not for the faint of heart lol

I'd recommend looking at these links:
https://developers.arcgis.com/javascript/latest/sample-code/intro-popuptemplate/

https://developers.arcgis.com/javascript/latest/sample-code/popup-actions/

 

0 Kudos
MHO_Harbors
Occasional Contributor

Ok, thank you. I guess we'll need the Developer's Edition. I might ask ESRI how to to this at the UC in July.

0 Kudos