Analysis Widget

Jump to solution
04-10-2015 12:53 PM
Occasional Contributor III

JAVA WAB 1.1 has a great new tool in the analysis widget.  However, my enthusiasm was short lived when I found that the tool could only work with AGOL services...which renders this tool virtually useless.  I'm thinking not to many agencies have the number of users, or the amount of credits needed, to hand out a website with this widget and allow outside groups to access and write data, (consume credits), out of your their organization.

So, my real question... has anyone hacked this to run off of a local service out of ArcGIS Server?  If I can produce the service in house I should be able to consume it in house!!!! 

Any advice or input is appreciated!


Robert Scheitlin, GISP

Rebecca Strauch

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MVP Esteemed Contributor


   Have tried just using the GeoProcessing widget that is part of WAB for this?

View solution in original post

9 Replies
MVP Esteemed Contributor

Hi Nicholas,

Sorry I didn't respond earlier, but I haven't had a chance yet to do much with WAB 1.1....maybe this week.  Just guessing though, I would think that if you use the LocalLayer widget  LocalLayerWidget and AccessifizrWidget   to acess you local services, that the analysis widget would be able to access them also (again, not tested and not confirmed yet).

Are you using the LocalLayer widget with your ArcGIS Server services already and does that all seem to be working (i.e. nothing being blocked do to permissions or anything?).  If so, and the analysis widget still has errors, if may be something that needs to be hardcoded/tweaked. I haven't seen any custom widgets for analysis yet...but that doesn't mean there isn't something out there that I haven't seen yet (I try to keep up on my resource list....but may not see everything right away).

Occasional Contributor III

Hi Rebecca,

No worries.  I am using the local layer widget.  Based on what I've seen from the code / interface it forces my to add an AGOL Service and save any datasets into AGOL.  Neither option is desirable, but the last one is exceptionally troubling since it would consume credits every time someone pulled data from us...not to mention we would have to add them as a user in our Org.  I really don't know what ESRI is thinking with this AGOL, but I feel like they are shooting themselves in the foot with it.  I plan on doing some more digging in the code today to see what I can uncover.



0 Kudos
Occasional Contributor III

Based on the info I have found the Analysis tools can only be used with AGOL.  I have some custom code that uses my URL information.  I pulled this from the ArcGIS API Samples page.  Anyways, I have that running successfully, but my next massive hurdle is getting it into a usable Widget in WAB.

MVP Esteemed Contributor

I still haven't had a chance to try, but I'll keep tabs on your progress. 

Occasional Contributor III

Well here is what I have so far.  I was able to grab the sample Data Extract Widget and get it working, but this is a self contained website, which is very plain.  Since I have very limited programming skills I have most likely taken this as far as I can.

I'm struggling with trying to get this code converted over to a usable widget... either in WAB or outside.


<!DOCTYPE html>



    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>

    <title>Data Download</title>

    <link rel="stylesheet" href="">

    <link rel="stylesheet" href="">


      html, body, #map {

        height: 100%;

        width: 100%;

        margin: 0;

        padding: 0;


      #HomeButton {

      position: absolute;

      top: 95px;

      left: 20px;

      z-index: 50;


      body {

        background-color: #FFF;

        overflow: hidden;

        font-family: "Trebuchet MS";


      .claro .dijitBorderContainer-child {

        border: none;


      .claro .dijitBorderContainer-dijitContentPane, .claro .dijitContentPane {

        padding: 0;


      .claro .dijitTitlePaneContentInner {

        line-height: 1.4em;


      #controls {



         width:auto !important;

         height:auto !important;



      #loading {

        display: none;

        vertical-align: middle;


      .freehandIcon { background-image:url(./images/i_draw_freepoly.PNG); width:20px; height:20px; }

      .polyIcon { background-image:url(./images/i_draw_poly.png); width:20px; height:20px;}



    <script src=""></script>


      var gp, map;

      require(["esri/map", "esri/dijit/HomeButton", "esri/dijit/Scalebar", "esri/config",


        "esri/tasks/Geoprocessor", "esri/tasks/FeatureSet", "esri/toolbars/draw",

        "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol",



        "dojo/dom", "dojo/dom-style", "dojo/query", "dojo/parser",


        "dijit/layout/BorderContainer", "dijit/layout/ContentPane",

        "dijit/TitlePane", "dijit/form/CheckBox", "dijit/form/ComboBox",

        "dojo/domReady!"], function(Map, HomeButton, Scalebar, esriConfig,


        Geoprocessor, FeatureSet, Draw,

        SimpleFillSymbol, SimpleLineSymbol,



        dom, domStyle, query, parser,




        // Create all dijits.



        // Prevent flash of unstyled content(FOUC).

        domStyle.set(query("body")[0], "visibility", "visible");

        // Specify where the location of the proxy to use to communicate with the extract GP service. = "/proxy/";

        // Keep a reference to the loading icon DOM node.

        var loading = dom.byId("loading");


        map = new Map("map", {

          basemap: "",

          center: [-77.844, 41.834],

          zoom: 10



        home = new HomeButton({

        map: map

        }, "HomeButton");



        scalebar = new Scalebar({

          map: map,

          // "dual" displays both miles and kilmometers

          // "english" is the default, which displays miles

          // use "metric" for kilometers

          scalebarUnit: "dual"



        map.on("load", initSelectionToolbar);


var homelandSecurity = new ArcGISDynamicMapServiceLayer("http://..../arcgis/rest/services/sitename/MapServer");



        gp = new Geoprocessor("http://.../arcgis/rest/services/.../GPServer/Extract%20Data%20Task");



        registry.byId("polygon").on("click", function() {



        registry.byId("freehandpolygon").on("click", function() {



        registry.byId("extract").on("click", extractData);

        function initSelectionToolbar() {


          selectionToolbar = new Draw(map);

          selectionToolbar.on("draw-end", function(e) {


            var symbol = new SimpleFillSymbol(


              new SimpleLineSymbol("dash", new Color([255,0,0]), 2),

              new Color([255,255,0,0.25])


            var graphic = new Graphic(e.geometry, symbol);




        function activateTool(tool) {


          // The draw.activate expects a string like "polygon" or "freehand_polygon".




        function extractData(){

          //get clip layers

          var clipLayers = [];

          if ( registry.byId("layer0").get("checked") ) { clipLayers.push("schools"); }

          if ( registry.byId("layer1").get("checked") ) { clipLayers.push("villages"); }

          if ( registry.byId("layer2").get("checked") ) { clipLayers.push("streams"); }

          if ( registry.byId("layer3").get("checked") ) { clipLayers.push("streets"); }

          if ( registry.byId("layer4").get("checked") ) { clipLayers.push("railway"); }

          if ( registry.byId("layer5").get("checked") ) { clipLayers.push("driveways"); }

          if ( registry.byId("layer6").get("checked") ) { clipLayers.push("utils"); }

          if ( registry.byId("layer7").get("checked") ) { clipLayers.push("buildings"); }

          if ( registry.byId("layer8").get("checked") ) { clipLayers.push("ipars"); }

          if ( registry.byId("layer9").get("checked") ) { clipLayers.push("Parcels_Owner"); }

          if ( registry.byId("layer10").get("checked") ) { clipLayers.push("WaterSA"); }

          if ( registry.byId("layer11").get("checked") ) { clipLayers.push("Centre"); }

          if ( clipLayers.length === 0 || === 0 ) {

            alert("Select layers to extract and draw an area of interest.");



          var featureSet = new FeatureSet();

          var features = [];


          featureSet.features = features;

          var params = {

            "Layers_to_Clip": clipLayers,

            "Area_of_Interest": featureSet,

            "Feature_Format": registry.byId("formatBox").get("value")


          domStyle.set(loading, "display", "inline-block");

          gp.submitJob(params, completeCallback , statusCallback, function(error){


            domStyle.set(loading, "display", "none");



        function completeCallback(jobInfo){

          if ( jobInfo.jobStatus !== "esriJobFailed" ) {

            gp.getResultData(jobInfo.jobId, "Output_Zip_File", downloadFile);



        function statusCallback(jobInfo) {

          var status = jobInfo.jobStatus;

          if ( status === "esriJobFailed" ) {


            domStyle.set("loading", "display", "none");


          else if (status === "esriJobSucceeded"){

            domStyle.set("loading", "display", "none");



        function downloadFile(outputFile){


          var theurl = outputFile.value.url; 

          window.location = theurl;





  <body class="claro">

    <div data-dojo-type="dijit/layout/BorderContainer"


         style="width: 100%; height: 100%;margin:0;">

      <div id="map"



           <div id="HomeButton"></div>


        <div data-dojo-type="dijit/TitlePane"  data-dojo-props="title:'Extract Data'" id="controls">

          1.Select area of interest


          <button id="polygon"


            data-dojo-props="iconClass:'polyIcon', showLabel:false">



          <button id="freehandpolygon"


            data-dojo-props="iconClass:'freehandIcon', showLabel:false">




          2.Select Layers to extract data from


          <input id="layer0" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer0">Schools</label><br>

          <input id="layer1" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer1">Villages</label><br>

          <input id="layer2" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer2">Streams</label><br>

          <input id="layer3" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer3">Streets</label><br>

          <input id="layer4" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer4">Railway</label><br>

          <input id="layer5" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer5">Driveways</label><br>

          <input id="layer6" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer6">Utility Roads</label><br>

          <input id="layer7" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer7">Buildings</label><br>

          <input id="layer8" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer8">Unsold Lots</label><br>

          <input id="layer9" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer9">Parcels</label><br>

          <input id="layer10" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer10">Water Service Areas</label><br>

          <input id="layer11" data-dojo-type="dijit/form/CheckBox" checked="checked" type="checkbox"/>

          <label for="layer11">Municipal Lines</label>


          3.Specify download format


          <select data-dojo-type="dijit/form/ComboBox" id="formatBox">

            <option>Shapefile - SHP - .shp</option>

            <option>File Geodatabase - GDB - .gdb</option>

            <option>Autodesk AutoCAD - DXF_R2007 - .dxf</option>

            <option>Autodesk AutoCAD - DWG_R2007 - .dwg</option>

            <option>Bentley Microstation Design (V8) - DGN_V8 - .dgn</option>           



          <button id="extract" data-dojo-type="dijit/form/Button">Extract Data</button>

          <img id="loading" src="images/loading.gif">







0 Kudos
MVP Esteemed Contributor


   Have tried just using the GeoProcessing widget that is part of WAB for this?

Occasional Contributor III

no....but I will look into it.

0 Kudos
Occasional Contributor III

Robert....good call.  I never thought to look in there.  I was so focused on the analysis tool that they released.  Works great!

I'm really surprised that the Tech Support didn't think of this either.

0 Kudos
MVP Esteemed Contributor

well...that seems like a much simpler solution. 

0 Kudos