[GIS] How to add a layer to Web AppBuilder at run-time

arcgis-web-appbuilder

ArcGIS Server Web AppBuilder is intended to show layers which were first compiled into an ArcGIS Online web map:

Data content for Web AppBuilder is defined and based on web maps

Is it possible to add a layer directly from ArcGIS Server using the unsupported Local Layer Widget, which allows feature, dynamic and tiled layers to be configured directly from their ArcGIS Server REST endpoints, but this needs to occur before the web app is published – the layer definitions are published with the app.

How can I allow the user to add a new layer to a map created by ArcGIS Server Web AppBuilder? The changes do not need to be persisted between sessions.

For example, is there an Add Data widget? Can I add the layer via URL parameters?

Best Answer

In the Summer 2016 release of WAB, a new widget is added:

Add Data widget – Enables you to search for layers in ArcGIS Online and add them to the map. You can also add ArcGIS Server web services, WMS OGC web services, KML, GeoRSS, and CSV data layers by specifying their URLs.

This means you will be able to add ArcGIS Server services in the runtime session of the application.