AnsweredAssumed Answered

Issue On Rendering Result Of ESRI Request On Graphic Layer

Question asked by behClevest on Jun 22, 2017
Latest reply on Jun 22, 2017 by behClevest

Running following code I am able to get JSON result back from a Geometric Network Service on ArcGIS Server but I am having trouble to add the Geometries (Returened graphic) to the graphicsLayerTraceNetworkEdges can you please let me know what I am doing wrong here?

As you can see I already tried both

var graphic = new esri.Graphic(featureSet[i]);

and

var graphic = new esri.Graphic(featureSet[i], symbolTraceNetworkEdges);

but neither of the adding any graphics to the graphicsLayerTraceNetworkEdges

Here is the code I am running

var symbolTraceNetworkEdges = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 3);

var graphicsLayerTraceNetworkEdges = new esri.layers.GraphicsLayer();
var rendererTraceNetworkEdges = new esri.renderer.SimpleRenderer(symbolTraceNetworkEdges);
graphicsLayerTraceNetworkEdges.setRenderer(rendererTraceNetworkEdges);
graphicsLayerTraceNetworkEdges.setInfoTemplate(infoTemplate);
map.addLayer(graphicsLayerTraceNetworkEdges);


function solve(traceSolverType, params) {

    esri.request({
        url:agsConfig.urlGNUtility(agsConfig.operationalLayers.GNLayer, gn /* id layer from soe*/, traceSolverType /*name of operation SOE */),
        content:params,
        callbackParamName:"callback",
        load:function (result) {
            graphicsLayerTraceNetworkEdges.clear();

             var resultFeatures = result.edges;
             console.log(resultFeatures);
             for (var j = 0, jl = resultFeatures.length; j < jl; j++) {
                  var featureSet = resultFeatures[j].features;
                   for (var i = 0, il = featureSet.length; i < il; i++) {
                      //var graphic = new esri.Graphic(featureSet[i]); 
                      var graphic = new esri.Graphic(featureSet[i], symbolTraceNetworkEdges);
                      graphicsLayerTraceNetworkEdges.add(graphic);
                            }
                        }

        });
    }
}

Attachments

Outcomes