Do you have to use AGOL to use WAB?

20406
48
08-13-2014 07:52 AM
RobertScheitlin__GISP
MVP Emeritus

All,

   I thought I would share some info on Web App Builder Beta 2.

Note this no longer applies to current releases of WAB.

I have been digging into the MapManager.js and have found that esri must be listening to all the complaints from users about being forced to us a WebMapID from AGOL and there is code in there to just use basemap and operational layers (like good old ArcGIS Viewer for Flex) in the config.json. They just have not exposed the ability to configure this in the WAB UI.

So in the config.json after going thorough the paces of choosing a WebMap from the ones available on AGOL your config.json will look like this for the map object.

"map": {
    "3D": false,
    "2D": true,
    "position": {
      "left": 0,
      "top": 40,
      "right": 0,
      "bottom": 0
    },
    "itemId": "6e03e8c26aad4b9c92a87c1063ddb0e3",
    "mapOptions": {
      "extent": {
        "xmin": -15000000,
        "ymin": 2700000,
        "xmax": -6200000,
        "ymax": 6500000,
        "spatialReference": {
          "wkid": 102100
        }
      }
    },
    "id": "map",
    "portalUrl": "http://YourOrg.maps.arcgis.com/"
  },
 

all you have to do is change it to something like this:

"map": {
    "3D": false,
    "2D": true,
    "position": {
      "left": 0,
      "top": 40,
      "right": 0,
      "bottom": 0
    },
    "basemaps": [{
      "label": "base map1",
      "url": "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer",
      "type": "tiled"
    }],
    "operationallayers": [{
      "label": "Earthquakes",
      "url": "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/...",
      "type": "feature"
    }],
    "mapOptions": {
      "extent": {
        "xmin": -15000000,
        "ymin": 2700000,
        "xmax": -6200000,
        "ymax": 6500000,
        "spatialReference": {
          "wkid": 102100
        }
      }
    },
    "id": "map",
    "portalUrl": "http://Calhoun.maps.arcgis.com/"
  },
 

Notice that I have just replaced the itemId with a basemaps and operationallayers objects.

I think this is great news

Message was edited by: Robert Scheitlin, GISP

48 Replies
RobertScheitlin__GISP
MVP Emeritus

Patrick,

   I don't know the answer to that one.

0 Kudos
sapnas
by
Occasional Contributor III

You can group it in your mxd/mapservice. The only issue though is there is a logic flaw. I was able to fix it as I have the source code.

0 Kudos
KeisukeNozaki
Occasional Contributor II

Robert,

Can I include more than two operational layers?

It seems only one shows up on the map.

Keisuke

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Keisuke,

  Sure you can. You may be doing something wrong in your json.

"operationallayers": [{ 

      "label": "Earthquakes", 

      "url": "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/...", 

      "type": "feature" 

    },{ 

      "label": "Earthquakes Since 1970", 

      "url": "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/Since_1970/MapServer/0", 

      "type": "feature" 

    }],

0 Kudos
sapnas
by
Occasional Contributor III

Robert,

Unlike flex viewer I noticed that there is still dependency on Portal url. The widgets does not load if I don't specify the Portal url.

0 Kudos
KeisukeNozaki
Occasional Contributor II

Thank you, I accidentally repeated operational layer tag.

0 Kudos
NathanielClement1
New Contributor II

Thank you for posting this, it works perfectly for our application since we want to use AGOL as little as possible. I have one question though, how would I go about adding an image service in this manner. Should it sill be in the operational layers list? Also, would it have to be tiled or can I just add the image service right from the rest point. I used the following code but when I launch the app in my browser the loading gif just spins and nothing happens.

            {

                "label": "Imagery",

                "url": "http://XXXXX..XXX.ca/arcgis/rest/services/CAL_XXXXL/Ikonos_Fall_08/ImageServer",

                "type":  "Image Server"

            }

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Nathan,

   The type would just be "image" not "Image Server"

DanielStoelb
Occasional Contributor III

I'm having the same error, but this time with all rest service endpoints coming from NOAA.  For example, here is the code that I have been using for the weather watches/warnings from NOAA:

"label":"NWS Watches/Warnings",

  "url":"http://gis.srh.noaa.gov/arcgis/rest/services/watchwarn/MapServer",

  "type":"dynamic",

  "visible":true,

  "opacity":0.6

Any ideas on why I'm receiving the spinning wheel and no legend for this service?

LarryStout
Occasional Contributor III

It looks like Esri has commented out the code that read the basemap and operational layers from the main config.json file in Beta 3.  The BasemapGallery Widget will still take basemaps defined in its config.json file, but I'm thinking that will surely change soon.

I guess we'll have to get used to using AGOL or Portal for our web map definitions.