URL Parameters with Instant Apps - specifically making certain layers visible

1099
1
10-31-2022 03:53 AM
MarkCooper5
Occasional Contributor II

Hi

We are using the sidebar instant app to create a map to accompany a policy document for our planning department. This has chapters on various subjects including housing, enviromnent, economy etc. The map has groups of layers relating to each subject.

I would like a hyperlink ine say the housing chapter to zoom to the map and switch on the housing layer. Is this possible to do using url parameters? I can't see much info on url parameters with these apps.

I guess the alternative would be to create a map for each chapter (which would be a pain!) and only have the relevant data switched on.

 

Thanks

0 Kudos
1 Reply
KellyHutchins
Esri Frequent Contributor

Ok I have an approach that might work for you. Currently it only works in Media but it will work in Sidebar after the November update.  In the app configuration search for the URL parameter option and enable it for the layer/field you want to search. In this test app I enabled it for the state names Then enable the Layer List and Share. Launch the app and then set the url param to the location you want (or zoom the map). Here's an example where we zoom into the specified state :

https://jsapi.maps.arcgis.com/apps/instant/media/index.html?appid=56bd5d5acfba40148dec6b4308f17f00&s...

Next turn on the layers that you want to be visible using the layer list then click the Share option and select "Copy Link". This will generate a url that is zoomed in to that state and honors the layer visibility that is set via the layer list. 

https://jsapi.maps.arcgis.com/apps/instant/media/index.html?appid=56bd5d5acfba40148dec6b4308f17f00&s...

 

Here's an example of the above but using the map extent instead of using the custom url param 

https://jsapi.maps.arcgis.com/apps/instant/media/index.html?appid=56bd5d5acfba40148dec6b4308f17f00&s...

 

So you could use the app to generate the links you want and then if you don't need share or the layer list in the app you can go into the configuration and disable those options. 

 

 

0 Kudos