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
Solved! Go to Solution.
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(){
agsDMSLayer = new ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/Transport/Surface_Transport/MapServer");
this.map.addLayer(agsDMSLayer);
}
});
});
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
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
Yeah sorry I guess I did not understand your question originally.
Dan
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(){
agsDMSLayer = new ArcGISDynamicMapServiceLayer("http://localhost:6080/arcgis/rest/services/Transport/Surface_Transport/MapServer");
this.map.addLayer(agsDMSLayer);
}
});
});
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
Thanks Robert,
I have found the correct forums since posting the original question.