3

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?

  • So, you want to publish a web application first and then allow users of this application to add AGS map services when they have launched the app, am I right? – Alex Tereshenkov Apr 11 '16 at 5:24
  • @AlexTereshenkov exactly - and they should be able to add them using a REST endpoint URL, eg sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/… – Stephen Lead Apr 11 '16 at 5:36
  • I remember I've developed a tiny widget with a text box that allowed users to paste the REST endpoint URL and click the Add button; this added the layer into the map. You can access the map object and then access its methods such as adding new layers. Doesn't LocalLayer allows adding layers in the run time? – Alex Tereshenkov Apr 11 '16 at 8:08
  • @AlexTereshenkov as far as I know the Local Layer widget doesn't allow it, so I guess I'll need to write my own functionality - thanks – Stephen Lead Apr 11 '16 at 22:54
  • Alternative approach would be to have different AGOL maps with different sets of layers and then switch using itemid in the querystring. But @AlexTereshenkov 's solution is much more elegant. – Pavel V. Jun 21 '16 at 5:32
3

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.

3

Stephen,

I've found a widget that does exactly what you need. It's called the AddService widget. The direct link to the .zip file is here. Unpack and paste the folder into the \WebAppBuilderForArcGIS\client\stemapp\widgets folder.

You will be able to supply a REST URL while running your application. The sample map service to test is: http://serverapps101.esri.com/arcgis/rest/services/Counties/MapServer. Tested on WAB 2.0.

enter image description here

Another handy widget is AddLayer widget which also lets a user add ArcGIS Server REST services, however, a user will only be able to add those layers that have been predefined by the administrator creating the app. Maybe you will find this one useful, too.

  • No problem at all, Stephen. No code should be written more than once ;) – Alex Tereshenkov Apr 22 '16 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.