Select to view content in your preferred language

AddLayer Widget

12486
21
02-06-2016 09:39 AM
Labels (1)

AddLayer Widget

The AddLayer Widget for ArcGIS Web AppBuilder allows users to add pre-defined map layers to the current map without having them to include them in the current web map. This provides an easy way to add ad-hoc layers to your web app.

Unlike the AddService Widget which requires the user the enter the url of the service, the AddLayer widget only allows users to display additional map layers that have been pre-defined by the site administrator.

Using the Widget

The AddLayer Widget is an in-panel widget that will be displayed in the toolbar of your WebApp Builder application. Click the AddLayer icon icon display the list of available layers. Click each layer you want to add to your map. These layers will be displayed on the map and may be toggled off or on using the standard LayerList widget. You can unclick the layers you do not want to show any more to remove them from the map.

AddLayer Widget

Each entry is the list is pre-defined when the configuring the widget.

Widget Setup

Source code and installation instructions may be found at GitHub - softwhere/AddLayer-Widget:

v1.3.1  - released on 2/21/0216

Download

Thanks to the City of Garland, Texas for sponsoring the initial development of the AddLayer Widget and releasing it to the community.

Portions of the configuration settings dialog for the AddLayer Widget were adapted from the configuration dialog of the excellent LocalLayer Widget .

Labels (1)
Tags (1)
Comments
RebeccaStrauch__GISP
MVP Emeritus

added to WAB resource list.  thanks.

FinbarGillen
Frequent Contributor

David McCourt

Can this widget be used to add in a map service rather than just individual layers?

RebeccaStrauch__GISP
MVP Emeritus

fin at, have you looked to see if Add Service Widget 1.2   will work for you?

FinbarGillen
Frequent Contributor

Rebecca,

The widget you mention works fine, however we want the user to be able to load a map service form a list rather than find, copy and paste a URL.

DavidMcCourt
Occasional Contributor

Sure, you would select all layers when adding the map service to the configuration.

If you add more layers to the service later on, you would need to update the widget configuration to include those new layers.

A single entry in the widget can add all layers from a map service - or just some layers.

Also, you can have multiple entries for the same service that show different layers.

DanielStoelb
Frequent Contributor

One thing that I have noticed is that if layers are loaded at the map service level, the sublayer settings set in the widget don't display properly in the layer list widget.  For example, setting the visible layers property to "1,2,3", but only the default layers turned on display in the layer list widget, which don't match your settings from the add layer widget.

However, the layers that you do set within the widget are displayed in the map, but the layer list widget doesn't match.

If I remember, this was also an issue with the Local Layer widget when it was first released.  Any thoughts?

RobertScheitlin__GISP
MVP Emeritus

Daniel,

  It is a problem where the Layer List widget does not listen for changes of layer visibility from other widgets.

DanielStoelb
Frequent Contributor

Is there an update that can be made for Layer List widget to listen to changes of the other widgets?  If so, where would I be making the change?

RobertScheitlin__GISP
MVP Emeritus

I have not investigated this, so I do not have one.

RodWoodfordOld
Frequent Contributor

Hi,

As an enhancement, would it be possible to include a fader control opaque to transparent next to the loaded layers (a similar function to the layerlist widget). Would be very useful for imagery layers and a more visible approach for the end user to find. Or is there another widget other than the layerlist widget that can provide this functionality already.

The problem with the layerlist widget in this workflow is that you cant control each layers settings, it's a global approach.

See screen shot below.

cheers

Rod

DanCarpiaux
Emerging Contributor

This widget is exactly what I am looking for. However when I configure the app, all my existing layers disappear in my map. The widget works fine but removes the other layers? Any ideas?

Dan

RodWoodfordOld
Frequent Contributor

Hi,

Quick question. Will this widget work with WADB 2.1?

cheers

deleted-user-CQZbjNeBXm49
Deactivated User

Yes Rod,

It does work with the WAB 2.1, just follow the "Upgrade" process as describe by ESRI, see link:

Upgrade apps—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers

Cheers

Baba

RodWoodfordOld
Frequent Contributor

Cheers Baba,

Yep got it working today. Seems to function ok.

Rod

deleted-user-CQZbjNeBXm49
Deactivated User

Hi David McCourt,

Thanks for this lovely widget, please I have tried using the widget for a password secured mapservice but when I put in the a login, it does not add the layers, keeps returning the log-in dialogue box?

Is there a reason for this?

Baba

deleted-user-CQZbjNeBXm49
Deactivated User

Solved this no need to worry David McCourt

Thanks for the widget

Baba

deleted-user-CQZbjNeBXm49
Deactivated User

Hi softwhere,

Was wondering if you had any plans of upgrading this widget to reflect some of the awesome upgrades done on the LocalLayer Widget?

Baba

LefterisKoumis
Frequent Contributor

When you add a layer, the layerlist is updated but it post the layer name with its parent directory in the map service.

The widget LocalLayer widget has a similar issue that it can be resolved with a modification in the LayerInfos.js. The same solution does not resolve the issue in Add Layer. 

Thanks.

UPDATE:

For those of you who would like to show just the name of the layer without the service name, in the folder:  (app)\jimu.js\LayerInfos\LayerInfos.js

under the _getLayerTitle function:

comment out line 2 and add line 3.

if (title) {
    //title = serviceName + " - " + title;          
    title=title;
} else {
    title = serviceName;            
} ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
by Anonymous User
Not applicable

does this work with secure services if there are multiple secured services? Reason I ask, is I was going to use this for a bunch of editing layers. I have a viewer that is password protected with secured services, but I want a second level of security for adding the /featureserver versions of the layers, to edit. This would be perfect as the viewer wouldn't bother people upon logging in for both passwords and only editors would know to go to this widget to load their layers and enter the editing credentials.  Clicking regular services works fine.  Clicking secure ones gives this in the console:


{"error":{"code":403,"subcode":2,"message":"User does not have permissions to access 'cema/shelters.mapserver'.","details":[]}}

However... if I log in with the "Editor" login, they load fine.  (But I don't want people using that or knowing it except the editors; everyone else should login with the Readonly one)

In the request I see it's trying to use the token from the first set of secured services (the readonly ones).  Thoughts?

by Anonymous User
Not applicable

Well.. in a way, nevermind. I just realized instantly, this is actually not a problem at all.  I simply have two user names for my secured services. One is a readonly user one is an editor. Guess what? I have the editor login access to all of them and readonly only accesses the MapServer versions of the layers. So editors login with their credential and read only viewers have a second login.  Now, if someone was logged in to view, and wanted to Edit, they'd have to reload the site and enter the editing credential to reset the Esri identity. Not too bad. Simple solutions are always nice!!  Hope this helps anyone in the same boat!   

TonyGroeneveld2
Occasional Contributor

Did you find a solution for this problem?

Version history
Last update:
‎02-06-2016 09:39 AM
Updated by:
Contributors