Using GIS Server with Web AppBuilder

4559
6
Jump to solution
10-02-2014 09:15 AM
NEvatt
by
New Contributor III

On the Web AppBuilder for ArcGIs (Beta) overview page (Overview—Web AppBuilder for ArcGIS (Beta) | ArcGIS ) it mentions the ability to "connect to server side resources such as map services from ArcGIS Server" .  What I am specifically trying to do is to create functions what will add map services via GIS Server as layers to the map (and later figure out how to add them to the layer list and legend).

 

I see that Web AppBuilder uses the esri JS api 3.10, but a simple map.addLayer(dynaLayer1) does not do the trick.

 

Any suggestions?

 

Thanks,

Nat

0 Kudos
1 Solution

Accepted Solutions
NEvatt
by
New Contributor III

The guys from ESRI UK were able to help me get this working.  I had been on the right general track, but the missing element was that I needed to be within the BaseWidget in order to add a layer to the map in WAB.

The working code within the widget looks like this:

//Load all the required dependencies that will be required by the widget workflow

define(['dojo/_base/declare','jimu/BaseWidget','esri/geometry/Point','esri/layers/ArcGISDynamicMapServiceLayer'],function(declare,BaseWidget,Point,ArcGISDynamicMapServiceLayer){

//variable to hold my dynamic map service layer

var agsDMSLayer;

return declare([BaseWidget], {

// demo widget code goes here

baseClass: 'jimu-widget-demo',

// event that fires on widget start up

startup: function(){

  1. this.inherited(arguments);  // this is required as the widget is derived from base widget class and the base widget class will populate the map property

agsDMSLayer = new ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/Transport/Surface_Transport/MapServer");

this.map.addLayer(agsDMSLayer);

}

});

});

View solution in original post

6 Replies
DanAllen
Occasional Contributor III

Hi Nat,

The Web app builder application looks for an ArcGIS.com map.  You can add your ArcGIS server layers to your ArcGIS.com map first as layers.  Once you save the ArcGIS.com map, those Server layers should show up in your Application built with the Web App Builder.  At least that is how i was able to do it.

Dan

0 Kudos
NEvatt
by
New Contributor III

Hi Dan,

Thanks for that.  I suppose I wasn't quite specific enough with my question.  I am able to add gis server layers to my Arcgis Online map, but what I really want to do is dynamically add other layers to the map after the Arcgis Online map (and web app) has already been loaded. 

In this way, I will be able to show specific layers dependent on which user is viewing the map.  That is why I am specifically interested in how web app builder and widgets interact with the GIS server directly.

-Nat

0 Kudos
DanAllen
Occasional Contributor III

Yeah sorry I guess I did not understand your question originally.

Dan

0 Kudos
NEvatt
by
New Contributor III

The guys from ESRI UK were able to help me get this working.  I had been on the right general track, but the missing element was that I needed to be within the BaseWidget in order to add a layer to the map in WAB.

The working code within the widget looks like this:

//Load all the required dependencies that will be required by the widget workflow

define(['dojo/_base/declare','jimu/BaseWidget','esri/geometry/Point','esri/layers/ArcGISDynamicMapServiceLayer'],function(declare,BaseWidget,Point,ArcGISDynamicMapServiceLayer){

//variable to hold my dynamic map service layer

var agsDMSLayer;

return declare([BaseWidget], {

// demo widget code goes here

baseClass: 'jimu-widget-demo',

// event that fires on widget start up

startup: function(){

  1. this.inherited(arguments);  // this is required as the widget is derived from base widget class and the base widget class will populate the map property

agsDMSLayer = new ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/Transport/Surface_Transport/MapServer");

this.map.addLayer(agsDMSLayer);

}

});

});

RobertScheitlin__GISP
MVP Emeritus

Nat,

   In the future you may want to post WAB questions in the Web AppBuilder space Web AppBuilder for ArcGIS‌ and there is a Custom WAB Widgets Group Web AppBuilder Custom Widgets

0 Kudos
NEvatt
by
New Contributor III

Thanks Robert,

I have found the correct forums since posting the original question.

0 Kudos