Select to view content in your preferred language

Unable to see the graphics layer in the map

2123
2
Jump to solution
02-22-2016 02:27 PM
PriyaRam
Deactivated User

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);

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
PriyaRam
Deactivated User

I figured the problem, it was the problem with the alpha value. It has to be a value from 0-255, rather we have set the value similar in Flex btwn 0 and 1.

Found an example here, which helped set the right symbology json literal for the Graphics object.

playground

View solution in original post

0 Kudos
2 Replies
YueWu1
by Esri Regular Contributor
Esri Regular Contributor

Hi Priya,


Have you tried to take a look about this sample DataGrid with zoom button | ArcGIS API for JavaScript

PriyaRam
Deactivated User

I figured the problem, it was the problem with the alpha value. It has to be a value from 0-255, rather we have set the value similar in Flex btwn 0 and 1.

Found an example here, which helped set the right symbology json literal for the Graphics object.

playground

0 Kudos