Select to view content in your preferred language

Enable popup for map-image layer in Scene View

10-03-2022 09:30 PM
Occasional Contributor

Hello, I have a 3D local scene which contains a map-image layer that contains about 30 sublayers. There's no option to turn on the popup on the sublayers when config it in the scene, therefore the popup didn't show up when bring the scene view in my JS API app. I'm wondering if there's way to enable popup for map-image sublayers in scene via JS API? thank you

0 Kudos
2 Replies
Esri Contributor

Hi @JackFanZhang -

You can configure the PopupTemplate on the MapImageLayer sublayers. Here's a simple example on how to do this with a scene from ArcGIS Online: 

Hope this helps!

Occasional Contributor

Thank you very much @LaurenBoyd 

Appreciate for sharing the code. Good to learn this could be done by supplying the feature layer with a new PopupTemplate object. The challenge I had was also about how to show the popup using the default template, which display all the visible attributes. With the suggested method, I would need to populate the contents for all sublayers (there're 40 of them in my case). Technically it is possible but need to write a bit extra code. Anyway I ended up doing this by manually load the feature layer then assign the layer's defaultPopupTempalte to the popupTemplate property, which works as expected.

    subLayer.popupEnabled = true;
    subLayer.popupTemplate = subLayer.defaultPopupTemplate



0 Kudos