Do you have to use AGOL to use WAB?

20273
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
JörgMoosmeier
Esri Contributor

Hi,

if you look into the internal structure of a WebMap

http://www.arcgis.com/sharing/content/items/a6a631378ad94c58a8a42d3f1e805143/data?f=pjson

you will find the WebMap is also structured into operational layers and basemaps.

The Webmap is a standardized format of a Map description (only with Web Technology, REST and JSON) for all (or most) Esri Clients. So Esri and devolopers don't have to reinvent a map description for every product or development.

I can use the same Webmap eg in Application Builder and Collector and ....

If you change the Webmap afterwards, other users with other clients can't use it, because it's exclusive for this development.

Joerg

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Joerg,

   Thanks, but I am really talking specifically about the current need for WAB users to have there map that they want to use in their WAB app in their organizational AGOL account so that an itemId from that map can be used in the generation of WebMap in WAB.

One of the biggest complaints users of the Beta has had is, why do they have to have a WebMap from AGOL when they have their own ArcGIS Server and could just provide their map service url instead of having to add their map to AGOL for use in WAB.

As Rene pointed out the basemaps and operationallayers are not part of an itemData object as in the spec, so the WAB developers are allowing for a more ArcGIS Viewer for Flex type of configuration.

0 Kudos
ReneRubalcava
Frequent Contributor

It might just be the use of arcgisUtils.createMap since it will will accept either a webmap id or a JSON of a webmap spec

esri | API Reference | ArcGIS API for JavaScript

This is also a handy way of defining your renderers via WebMap spec in JSON for use in your application. I have a WebMap spec editor in use for clients right now that works like this and it comes in real handy. Odd though, as I would expect the the basemap and operationalLayers would need to be in an itemData object, so maybe they did add some internal checks to do that little bit.

Either way, very cool catch for Web App Builder users.

0 Kudos
RayNeel
New Contributor

This is a great tip, and addresses a need that I have. I was able to get this to work nicely, and have both a Server and an AGOL layer showing in my WAB implementation. One question...I'm not getting attribute data when I click on the points that come up; any thoughts about that?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ray,

   It is likely that they have not finish all the needed work for this as they did not document or expose this in the GUI. I found that the Query widget did not recognize the layers added this way either. You will probably have to add the layers manually to the config.json for the attribute table.

RayNeel
New Contributor

Thanks, that makes some sense. I have tried numerous combinations in config.json to see if I can get popups from my ArcGIS Server layers, but no luck, so far. (I was able to trick earlier downloaded templates into giving me what I wanted with some creative JSON). Please post up if you see or hear anything that might help to resolve this!

--Ray

0 Kudos
ReneRubalcava
Frequent Contributor


Is this a Dynamic layer or FeatureLayer? If it's a FeatureLayer, you should be able to add the popupInfo to the layers JSON constructor and get the popups.

0 Kudos
sapnas
by
Occasional Contributor III


For Query Widget, YOu will have to configure "config_Query.json"  of the widget.

0 Kudos
AdminRFVL
New Contributor III

Is there a way to create groups/subgroups of operational layers when modifying the config.json?

TOC.PNG

0 Kudos