Hello,
I'm trying to setup a URL so when searched they open the web application, zoom to a certain extent and toggle on certain layers in the Layer List. I just cant get the layer toggling to work.
The result I want is the the two layers circled red below (which come in off by default) to be toggled on when the url is searched, is this possible with a Web Map Application?
If it is how should the following url be structured after the coordinates:
https://BASEURL/portal/apps/webappviewer/index.html?id=WEBMAPID&extent=-0.21621033880281487,51.48286593797613,-0.10844208698006919,51.53987710746235
Thanks
Solved! Go to Solution.
After some testing I have discovered how to accomplish my original goal: to switch on 'Community Rankings' and 'Combined Scores Overall' in the layer list using a URL. The working URL looks like this:
https://BASEURL/portal/apps/webappviewer/index.html?id=WEBMAPID&showLayers=Community_Rankings_1642_2;Community%20Rankings&find=E07000084
'Community_Rankings_1642_2' is the layer ID for 'Combined Scores Overall' so that was easy. 'Community Rankings' does not have a layer ID so I have used its name instead: Community%20Rankings (the %20 is added automatically when you search the URL without it)
The find parameter replaces the extent parameter as this will not only zoom to the extent but highlight the individual feature, in this case Local Authority coded E07000084.
Are you using web app builder? If you scroll to the "Set layers' visibility" section in the doc it looks like it covers the URL parameters
https://doc.arcgis.com/en/web-appbuilder/latest/manage-apps/app-url-parameters.htm
Thankyou for supplying that page.
So after checking the Layer id my url should look something like this:
https://BASEURL/portal/apps/webappviewer/index.html?id=WEBMAPID&extent=-0.25500376577205974,51.46313587115225,-0.17381282174790066,51.53242372785858&showLayers=Community_Rankings_1642_22;Community_Rankings_1642_23;Community_Rankings_1642_24
This URL should switch on the following layers but when inputted only two of the 3 are showing:
Im really confused here the as the ID of layer 'LA Education' should be 'Community_Rankings_1642_22' and the others are turning on fine:
I've tried other combinations and there's many more inconsistencies that I cant work out a pattern for.
@GISAdministrator8the URL you provided looks good - is the LA layer out of the visibility extent? It looks greyed out and you might have a visibility restriction
Its nothing to do with the extent as 'LSOA Education' is also greyed out (because its not in the right zoom threshold) but ticked on.
I can somewhat get around this as I only need the layers turned on in the original post, but when I bring up the layer ID backend URL (http://<your portal url>/sharing/rest/content/items/<webmapItemID>/data/?f=pjson.) i cannot find the layer ID for 'Community Rankings' and 'Combined Scores Overall'. Im assuming this is because they are Titles and not data layers.
After some testing I have discovered how to accomplish my original goal: to switch on 'Community Rankings' and 'Combined Scores Overall' in the layer list using a URL. The working URL looks like this:
https://BASEURL/portal/apps/webappviewer/index.html?id=WEBMAPID&showLayers=Community_Rankings_1642_2;Community%20Rankings&find=E07000084
'Community_Rankings_1642_2' is the layer ID for 'Combined Scores Overall' so that was easy. 'Community Rankings' does not have a layer ID so I have used its name instead: Community%20Rankings (the %20 is added automatically when you search the URL without it)
The find parameter replaces the extent parameter as this will not only zoom to the extent but highlight the individual feature, in this case Local Authority coded E07000084.