Select to view content in your preferred language

Adding a feature layer in WAB 1.3

4177
4
05-20-2016 10:24 PM
WayneBoras
Regular Contributor

I'm trying to add a feature layer from ArcGIS Server to my app. When I add the feature service URL to the operational layers in config.json, it doesn't get added to the map. Adding the map service URL for the same layer works fine. Do I have to add it programatically?

Thanks for any help.

Wayne

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Wayne,

  I am a little confused by this comment:

When I add the feature service URL to the operational layers in config.json
Adding the map service URL for the same layer works fine

Adding service url to the config.json has not been supported since the Beta2 of WAB.

All layers have to be added to the web map that the app uses or you have to use custom widgets to handle this like the Local Layer widget.

0 Kudos
WayneBoras
Regular Contributor

Hi Robert,

Sorry for not being more clear with my original question. If I add the Map Service to the config file as follows, it works fine:

"operationalLayers":
        [
        {
          "url": "http://myserver:6080/arcgis/rest/services/Maps/MyService/MapServer",
          "visibility": true,
          "opacity": 1,
          "title": "My Map Service"
        }       
        ],

When I step through the code, map.layerIds has two elements: base0 and operational0. I can access features using the operational0 id.

However, I would instead like to add the feature layer so that I can perform feature editing via a custom widget that I've created. I tried to add the feature layer by replacing the above code as follows:

"operationalLayers":
        [
        {
          "url": "http://myserver:6080/arcgis/rest/services/Maps/MyService/FeatureServer/0",
          "visibility": true,
          "opacity": 1,
          "title": "My Feature Service"
        }       
        ],

In this case, map.layerIds only has the base0 element; the operational layer has not been added to the map, so I can't access the features.

Hopefullly this is a better explanation.

Thanks,

Wayne

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Wayne,

  Adding layers in this way to the config.json is not supported. You should look at the Local Layer Widget.

WayneBoras
Regular Contributor

Thanks Robert, I will have a look at the Local Layer Widget.

0 Kudos