AnsweredAssumed Answered

Graphics not showing on the map.

Question asked by sanjayjadhav on Jan 31, 2015
Latest reply on Feb 2, 2015 by timw1984

Hello,

 

I'm developing study application using ArcGIS API for JavaScript.

 

In this application, I'm executing query on a feature layer added to a map using simple where clause,e.g. STATE_NAME = 'Arizona'. In the query completed event,I'm getting my feature as a result. Then I add it as graphic to the map. I debugged the code in Firefox and confirmed that It is getting added to the map successfully.

 

But my problem is, this graphics is not visible on the map in the browser. I have put my code below for reference.

 

define(["esri/tasks/QueryTask", "esri/tasks/query", "dojo/_base/lang", "dojo/on", "esri/symbols/SimpleFillSymbol", "esri/Color", "esri/symbols/SimpleLineSymbol", "esri/graphic", "esri/map"],   function(QueryTask,Query,lang,on,SimpleFillSymbol,Color,SimpleLineSymbol,Graphic,Map){      return{    queryStatesLayer:function(sqlString,layerURL,outFlds,mapControl){   var query,queryTask;   queryTask = new QueryTask(layerURL);   query = new Query();   query.returnGeometry = true;   query.where = sqlString;        //configure the call back function   queryTask.execute(query, lang.hitch(this,function(results){   this.queryCompleted(results,mapControl);   }));   },    //this function is called when the query is completed   queryCompleted:function(featureSet,map){       //remove all graphics on the maps graphics layer   map.graphics.clear();    var resultFeatures = featureSet.features;   var symbol = new SimpleFillSymbol().setColor(null).outline.setColor("blue");    for (var i=0, il=featureSet.features.length; i<il; i++) {   var graphic = featureSet.features[i];   graphic.setSymbol(symbol);   map.graphics.add(graphic);   alert(map.graphics.graphics.length);   }        }//queryCompleted function ends here..   }; }); //define function ends..

 

I would appreciate any help on this problem. I'm not being able to figure out why the graphics is not showing up on the map.

 

S.

Outcomes