function outputOfTwoLayers(results){
var allFeatureSet = [];
arrayUtils.forEach(results,function(value,key){
arrayUtils.forEach(results[key].features,function(value,key){
allFeatureSet.push(value);
});
});
var featureCollection = {
"layerDefinition": null,
"featureSet": {
"features" : allFeatureSet,
"geometryType": "esriGeometryPolygon"
}
};
featureCollection.layerDefinition = {
"geometryType": "esriGeometryPolygon",
"objectIdField": "OBJECTID",
"fields": [{
"name": "OBJECTID",
"alias": "OBJECTID",
"type": "esriFieldTypeOID"
},
{
"name": "TOTPOP_CY",
"alias": "2016 Total Population (Esri)",
"type": "esriFieldTypeInteger"
},
{
"name": "RTSALESTOT",
"alias": "2016 Total Retail Sales (including Food/Drink Sales)",
"type": "esriFieldTypeDouble"
},
{
"name": "title",
"alias": "Title",
"type": "esriFieldTypeString"
}]
};
console.log(featureCollection);
var featureLayer3 = new FeatureLayer(featureCollection,{
showAttribution : true,
mode : FeatureLayer.SELECTION_ADD,
id : "smartMap",
"infoTemplate": {
title:"Smart Map Data",
content: "<b>TOTPOP_CY : </b> ${TOTPOP_CY} <br><b>RTSALESTOT : </b> ${RTSALESTOT} <br>"}
});
console.log(featureLayer3);
console.log(mapObj);
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,255,255,1.0]), 1),new dojo.Color([125,125,125,0.35]));
featureLayer3.setRenderer(new esri.renderer.SimpleRenderer(symbol));
mapObj.addLayer(featureLayer3);
};