AnsweredAssumed Answered

FeatureLayer from FeatureCollection

Question asked by lkoumis on Dec 15, 2015
Latest reply on Dec 22, 2015 by lkoumis
Branched from an earlier discussion

I get the Converting circular structure to JSON error when I create the feature layer, thislayer. Any ideas? Thank you..

 

 

var requestHandle = esriRequest({

            "url": myurl, //I set the variable to a featureservice url

            "content": {

              "f": "json"

            },

            "callbackParamName": "callback"

          });

 

          myfields =requestHandle.then(this.requestSucceeded, this.requestFailed);

 

   var layerDefinition = {

        "geometryType": "esriGeometryPoint",

        "fields": myfields,

         "objectIdField": "OBJECTID",

  }     

  var featureCollection = {

  layerDefinition: layerDefinition,

  featureSet: myfeatureSet  //it's derived from a query

  };

 

  var thislayer = new esri.layers.FeatureLayer(featureCollection, {

  id: "query layer",

        mode: FeatureLayer.MODE_SNAPSHOT,

  outFields:["*"]}

  );

 

  this._openResultInAttributeTable(thislayer);

      

      },

 

 

      requestSucceeded:function(response, io){

            fields = array.map(response.fields);

  return fields;

 

 

   },

        requestFailed: function(error, io){

  console.log("got an error");       

  }, 

Outcomes