Skip to main content


Hi,

I am just wondering if you know the way to get the list of the layers that are chosen in particular Layer List widget in ArcGIS Web AppBuilder. I have used:

  • ArcGISOnlineConnector to get into the web app

and

  • HTTPCaller with Request URL that have following structure

https://YourPortalUrl/portal/sharing/rest/content/items/YourItemId/data?f=json

Unfortunately t the only infrmation that I got in _response_body in relation to this widget is the label given for the widget in the app


"id": "widgets_LayerList_Widget_20",
"index": 5,
"label": "Layer List_2",
"name": "LayerList",
"uri": "widgets/LayerList/Widget",
"version": "2.21"

 

 

Hey, assuming these two questions are loosely related -


Took me a moment to get my head back into it, but here is a very high level description of the relationships of items/maps/apps/layers in regards to WAB…

You WAB App references a map, which contains layers, which are then shown in the map.

In the WAB config json (accessed through that url you posted), you should have the config for the LayerListWidget. In FME speak, that will be JSONO“widgetOnScreen”]e“widgets”]i4] - that last index might be different depending on what widgets you have.

Under that is the config object which subsequently has layerOptions then the display settings of each layer
 

 

Now of course those IDs aren’t that helpful. You can ‘decode’ these into the actual names by getting the config json of the map.

 

The map item ID is JSONm“map”]m“itemId”]. Putting this into that same url will pull the json for that map. Pulling down that config file then allows you to pull out the layer id and title - JSONe“operationalLayers”]


  •  

     


  •  

     Hi,

     

    Thank you for looking into it. However, I am not entirely sure how can I get a JSON that will have the structure from your screen. 

     

    In my current workflow I have 4 transformers only

     


    _resposne_body does have the information I need 

     

    {
    "_buildInfo": {
    "widgetManifestsMerged": true
    },
    "appId": "",
    "appItemId": "ddxxxxxxx",
    "authorizedCrossOriginDomains": o
    ],
    "dataSource": {
    "dataSources": {
    },
    "settings": {
    }
    },
    "geometryService": "https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",
    "httpProxy": {
    "url": "https://xxx.com/portal/sharing/proxy",
    "useProxy": true
    },
    "isWebTier": false,
    "keepAppState": true,
    "links": "
    ],
    "loadingPage": {
    "backgroundColor": "#508dca",
    "backgroundImage": {
    "visible": false
    },
    "loadingGif": {
    "height": 29,
    "uri": "configs/loading/images/predefined_loading_1.gif",
    "visible": true,
    "width": 58
    }
    },
    "logo": "https://xx.com/portal/sharing/rest/content/items/xxxxx/data",
    "map": {
    "2D": true,
    "3D": false,
    "id": "map",
    "itemId": "xxxx",
    "mapOptions": {
    },
    "portalUrl": "https://xxx.com/portal/",
    "position": {
    "bottom": 0,
    "left": 0,
    "right": 0,
    "top": 40
    }
    },
    "mobileLayout": {
    "widgetOnScreen": {
    "widgets": {
    "widgets/Coordinate/Widget": {
    "position": {
    "bottom": 17,
    "left": 7
    },
    "version": "1.4"
    },
    "widgets/Scalebar/Widget": {
    "position": {
    "bottom": 40,
    "left": 7
    },
    "version": "1.4"
    }
    }
    }
    },
    "portalUrl": "https://xxx.com/portal",
    "subtitle": "with ArcGIS Web AppBuilder",
    "theme": {
    "customStyles": {
    "mainBackgroundColor": "#009df0"
    },
    "name": "FoldableTheme",
    "sharedTheme": {
    "isPortalSupport": true,
    "useHeader": true,
    "useLogo": true
    },
    "styles": s
    "yellow",
    "default",
    "black",
    "blue",
    "cyan",
    "green",
    "purple",
    "red"
    ],
    "version": "2.21"
    },
    "title": "WebApp_ForTesting",
    "wabVersion": "2.21",
    "widgetOnScreen": {
    "panel": {
    "position": {
    "relativeTo": "map"
    },
    "uri": "jimu/OnScreenWidgetPanel"
    },
    "widgets": i
    {
    "id": "themes_FoldableTheme_widgets_HeaderController_Widget_1",
    "name": "HeaderController",
    "position": {
    "height": 40,
    "left": 0,
    "relativeTo": "browser",
    "right": 0,
    "top": 0
    },
    "uri": "themes/FoldableTheme/widgets/HeaderController/Widget",
    "version": "2.21"
    },
    {
    "id": "widgets_Scalebar_Widget_2",
    "name": "Scalebar",
    "position": {
    "bottom": 25,
    "left": 7,
    "relativeTo": "map"
    },
    "uri": "widgets/Scalebar/Widget",
    "version": "2.21"
    },
    {
    "id": "widgets_Search_Widget_3",
    "name": "Search",
    "position": {
    "left": 55,
    "relativeTo": "map",
    "top": 5
    },
    "uri": "widgets/Search/Widget",
    "version": "2.21"
    },
    {
    "id": "widgets_Coordinate_Widget_4",
    "name": "Coordinate",
    "position": {
    "bottom": 5,
    "left": 7,
    "relativeTo": "map"
    },
    "uri": "widgets/Coordinate/Widget",
    "version": "2.21"
    },
    {
    "id": "_5",
    "placeholderIndex": 1,
    "position": {
    "left": 55,
    "relativeTo": "map",
    "top": 45
    }
    },
    {
    "id": "_6",
    "placeholderIndex": 2,
    "position": {
    "left": 105,
    "relativeTo": "map",
    "top": 45
    }
    },
    {
    "id": "_7",
    "placeholderIndex": 3,
    "position": {
    "left": 155,
    "relativeTo": "map",
    "top": 45
    }
    },
    {
    "id": "_8",
    "placeholderIndex": 4,
    "position": {
    "left": 205,
    "relativeTo": "map",
    "top": 45
    }
    },
    {
    "id": "_9",
    "placeholderIndex": 5,
    "position": {
    "left": 255,
    "relativeTo": "map",
    "top": 45
    }
    },
    {
    "id": "widgets_OverviewMap_Widget_10",
    "name": "OverviewMap",
    "position": {
    "bottom": 0,
    "relativeTo": "map",
    "right": 0,
    "zIndex": 1
    },
    "uri": "widgets/OverviewMap/Widget",
    "version": "2.21"
    },
    {
    "id": "widgets_HomeButton_Widget_11",
    "name": "HomeButton",
    "position": {
    "left": 7,
    "relativeTo": "map",
    "top": 75
    },
    "uri": "widgets/HomeButton/Widget",
    "version": "2.21"
    },
    {
    "id": "widgets_MyLocation_Widget_12",
    "name": "MyLocation",
    "position": {
    "left": 7,
    "relativeTo": "map",
    "top": 110
    },
    "uri": "widgets/MyLocation/Widget",
    "version": "2.21"
    },
    {
    "id": "widgets_AttributeTable_Widget_13",
    "name": "AttributeTable",
    "position": {
    "relativeTo": "browser"
    },
    "uri": "widgets/AttributeTable/Widget",
    "version": "2.21"
    },
    {
    "id": "widgets_Splash_Widget_14",
    "name": "Splash",
    "position": {
    "relativeTo": "browser"
    },
    "uri": "widgets/Splash/Widget",
    "version": "2.21",
    "visible": false
    },
    {
    "id": "widgets_ZoomSlider_Widget_15",
    "name": "ZoomSlider",
    "position": {
    "left": 7,
    "relativeTo": "map",
    "top": 5
    },
    "uri": "widgets/ZoomSlider/Widget",
    "version": "2.21"
    },
    {
    "id": "widgets_ExtentNavigate_Widget_16",
    "name": "ExtentNavigate",
    "position": {
    "left": 7,
    "relativeTo": "map",
    "top": 190
    },
    "uri": "widgets/ExtentNavigate/Widget",
    "version": "2.21",
    "visible": false
    },
    {
    "id": "widgets_FullScreen_Widget_17",
    "name": "FullScreen",
    "position": {
    "left": 7,
    "relativeTo": "map",
    "top": 150
    },
    "uri": "widgets/FullScreen/Widget",
    "version": "2.21",
    "visible": false
    }
    ]
    },
    "widgetPool": {
    "groups": g
    ],
    "panel": {
    "position": {
    "bottom": 5,
    "relativeTo": "map",
    "right": 5,
    "top": 5,
    "zIndex": 5
    },
    "uri": "themes/FoldableTheme/panels/FoldablePanel/Panel"
    },
    "widgets": i
    {
    "id": "widgets_Legend_Widget_18",
    "index": 2,
    "name": "Legend",
    "uri": "widgets/Legend/Widget",
    "version": "2.21"
    },
    {
    "config": {
    "contextMenu": {
    "ControlLabels": true,
    "DescriptionOrShowItemDetailsOrDownload": true,
    "EnableOrDisablePopup": true,
    "MoveupOrMovedown": true,
    "OpenAttributeTable": true,
    "SetVisibilityRange": true,
    "Transparency": true,
    "ZoomTo": true
    },
    "expandAllLayersByDefault": false,
    "layerOptions": {
    "18ee662051a-layer-4": {
    "display": false
    },
    "18ee662051a-layer-4_0": {
    "display": true
    },
    "18ee66258db-layer-10": {
    "display": false
    },
    "18ee662961b-layer-11": {
    "display": false
    },
    "18ee662961b-layer-11_0": {
    "display": true
    },
    "18ee662961b-layer-11_1": {
    "display": true
    },
    "18ee662961b-layer-11_2": {
    "display": true
    },
    "18ee662961b-layer-11_3": {
    "display": true
    },
    "18ee664f46b-layer-13": {
    "display": false
    },
    "18ee664f46d-layer-15": {
    "display": true
    },
    "18ee66557ad-layer-18": {
    "display": false
    },
    "18ee66557ad-layer-18_0": {
    "display": true
    },
    "18ee66557ad-layer-18_1": {
    "display": true
    },
    "18ee66557ad-layer-18_156": {
    "display": true
    },
    "18ee716a799-layer-8": {
    "display": false
    },
    "18ee716a799-layer-8_0": {
    "display": true
    },
    "18ee716b3ae-layer-9": {
    "display": false
    },
    "18ee716de3b-layer-10": {
    "display": false
    },
    "18ee716de3b-layer-10_0": {
    "display": true
    },
    "18ee716de3b-layer-10_1": {
    "display": true
    },
    "18ee716de3b-layer-10_17": {
    "display": true
    }
    },
    "showBasemap": false,
    "showLegend": true,
    "showTitle": true
    },
    "id": "widgets_LayerList_Widget_19",
    "index": 3,
    "name": "LayerList",
    "uri": "widgets/LayerList/Widget",
    "version": "2.21"
    },
    {
    "config": {
    "contextMenu": {
    "ControlLabels": true,
    "DescriptionOrShowItemDetailsOrDownload": true,
    "EnableOrDisablePopup": true,
    "MoveupOrMovedown": true,
    "OpenAttributeTable": true,
    "SetVisibilityRange": true,
    "Transparency": true,
    "ZoomTo": true
    },
    "expandAllLayersByDefault": false,
    "layerOptions": {
    "18ee662051a-layer-4": {
    "display": false
    },
    "18ee662051a-layer-4_0": {
    "display": true
    },
    "18ee66258db-layer-10": {
    "display": false
    },
    "18ee662961b-layer-11": {
    "display": false
    },
    "18ee662961b-layer-11_0": {
    "display": true
    },
    "18ee662961b-layer-11_1": {
    "display": true
    },
    "18ee662961b-layer-11_2": {
    "display": true
    },
    "18ee662961b-layer-11_3": {
    "display": true
    },
    "18ee664f46b-layer-13": {
    "display": false
    },
    "18ee664f46d-layer-15": {
    "display": false
    },
    "18ee66557ad-layer-18": {
    "display": false
    },
    "18ee66557ad-layer-18_0": {
    "display": true
    },
    "18ee66557ad-layer-18_1": {
    "display": true
    },
    "18ee66557ad-layer-18_156": {
    "display": true
    },
    "18ee716a799-layer-8": {
    "display": false
    },
    "18ee716a799-layer-8_0": {
    "display": true
    },
    "18ee716b3ae-layer-9": {
    "display": true
    },
    "18ee716de3b-layer-10": {
    "display": false
    },
    "18ee716de3b-layer-10_0": {
    "display": true
    },
    "18ee716de3b-layer-10_1": {
    "display": true
    },
    "18ee716de3b-layer-10_17": {
    "display": true
    }
    },
    "showBasemap": false,
    "showLegend": true,
    "showTitle": true
    },
    "id": "widgets_LayerList_Widget_20",
    "index": 5,
    "label": "Layer List_2",
    "name": "LayerList",
    "uri": "widgets/LayerList/Widget",
    "version": "2.21"
    }
    ]
    }
    }

    How can I change the HTTPCaller to give me the JSON I need?

    The  ArcGIS Web AppBuilder is published to Esri Entrprise

     


    I’ve attached an example workbench (2023.1) that will pull the various bits of JSON and give you a feature per layer in the layerlist widget, the id(s), title and is its set to display or not.

    I don’t have an Enterprise (Portal) env to test this in, so have only run it on AGOL


    Reply