WebApp Builder - Show Specific Layers

760
3
10-26-2020 12:54 PM
AFackler_NAPSG
Occasional Contributor

I currently have a web app that I want to create a URL parameter to only turn on one layer when that URL is selected. I found some documentation here but when I add in the "&showLayers=<featurelayerID>", the app opens with all the layers off. Is there something I am doing wrong?

URL I am trying to get working (there's a space between https:// and the rest of the URL as I couldn't display it without it changing to "ArcGIS Online Web Application") is here:

https:// napsg.maps.arcgis.com/apps/webappviewer/index.html?id=6dc469279760492d802c7ba6db45ff0e&showLayers=d957997ccee7408287a963600a77f61f

I think it's something with the sublayer in the feature layer I am trying to display found here https://www.arcgis.com/home/item.html?id=60c390dd7f804f05b73177825a485277 

Any guidance would be helpful. Thanks!

0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor

You have to include the parent layer of the sublayer.

Tip:
To make a sublayer visible on the map, all its parent layers must be in the showLayers list.

When the value for the showLayers= or hideLayers= parameter is empty, no layers or all layers will be visible, respectively.

0 Kudos
AFackler_NAPSG
Occasional Contributor

Ken,

How would I do that? I've been using the item ID of the feature layer and I'm not really sure what you mean by include the parent layer

-Adam

0 Kudos
KenBuja
MVP Esteemed Contributor

I apologize, I couldn't view the items when I responded, so I was thinking the map service had group layers. Instead of using the itemID of that data, use the layer IDs from the web map you're using in your app.

0 Kudos