AnsweredAssumed Answered

Unable to see the graphics layer in the map

Question asked by lingpri on Feb 22, 2016
Latest reply on Feb 25, 2016 by lingpri

Hi All -  I'm developing a custom application, where in user loads from standard boundraies (city/neighbourhood ) to get geometry, I execute a query to get results and during the query success, I call show results as seen below which populates the dgrid and outlines the geometry on the map. The grid is getting populated, but I don't the see the geometry being drawn on the map. Please advise what could be the problem. I'm totally lost. Could it be possible the Graphicslayer has to be moved to the top??, given that , there are other layers which is hiding them. (We call the Java middle tier to make the rest call, we don't make REST api calls from the client side)

 

                             _showResults: function(token, map,bndryType,featureSet) {

 

                                                        var layer = map.getLayer("drawLayer");

                                                         layer.clear();

                                                            var items = array.map(featureSet, function(feature) {

                                                                var drawByGraphic = new Graphic(feature );

                                                                var json = { };

                                                                json.bndryName = feature.attributes[token];

                                                                json.col1 = feature.attributes['OBJECTID'];

                                                                json.geometry = feature.geometry;

                                                                json.bndryType = bndryType;

                                                                json.isSelected = false;

                                                             

                                                                var sfs = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,

                                                                 new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,

                                                                     new Color([232,104,80]), 2),new Color([255,255,0,0.25])

                                                                 );

                                                                 layer.add(drawByGraphic);

                                                                return json;

                                                            });

                                                         if(items) {

                                                               items.sort(this._sortByName);

                                                                var memStore = new Memory({

                                                                    data: items,

                                                                    idProperty: 'col1'

                                                               });

                                                             this._bndryGrid.set("collection", memStore);

                                                             this._bndryGrid.set("selectionMode",'none');

                                                        }

                                                        else

                                                            this._bndryGrid.set("collection",null);

                                                        

                                            },

 

In the postcreate method , I init the GraphicLayers as below:

   this.drawLayer = new GraphicsLayer(layerArgs);

    this.bndryFillLayer = new GraphicsLayer(layerArgs1);

 

Also, I listen for the map loaded event and add these graphic layers to the map

 

   this.map.addLayer(this.drawLayer);

    this.map.addLayer(this.bndryFillLayer);

Outcomes