AnsweredAssumed Answered

Adding layers to the map from queryTask

Question asked by FloCAD on Dec 22, 2015
Latest reply on Mar 24, 2016 by FloCAD

Hi everyone,

 

I've got data on my arcgis server and I want to query these data thanks to the REST API and then, show the result of the query on the map !

I don't know how to explain it correctly but I would like to do the same thing that is done there but with the Web App Builder (for developpers) and not only with the API JS.

 

For now, my query is ok and I got a result (an array of features with, in each feature, an object Attributes and an object Geometry) but then and don't understand how to show this result as a layer on my map...

 

    _query_TablePositionSuffix: function (geoWhereClause){
        var queryTask = new QueryTask(this.arcgisServerURL + this.config.table_PositionSuffix);
        var query = new Query();
        query.returnGeometry = true;
        query.outSpatialReference = {"wkid":102100};
        query.returnDistinctValues = false;
        query.outFields = ['*'];
        query.where = geoWhereClause;
        queryTask.execute(query, lang.hitch(this, "on_query_TablePositionSuffix"));
    },
    
    on_query_TablePositionSuffix: function(results) {
        console.log(results);
     },

 

I tried some things like that but it didn't worked...

      array.forEach(results.features,function(feature){
            var graphic = feature;
            graphic.setSymbol(this.symbolPosition);            
            this.map.graphics.add(graphic);
          
        });

 

Thank you by advance for your help !

Outcomes