AnsweredAssumed Answered

Polyline graphics not displaying in Javascript API?

Question asked by ppalubinski on Jan 8, 2015

I am getting features (graphics) back from an IdentifyTask, setting a symbol and adding to a graphics layer.  Polygons and points show up just fine, but not lines

 

Has anyone else encountered this?  Is there something special I'm supposed to do with polylines?

 

Here is some of the code:

 

I am constructing the symbol from the following JSON:

 

"Line": {

  "type": "esriSLS",

  "style": "esriSLSSolid",

  "color": [17, 255, 251, 255],

  "width": 2

  }

 

The symbol is constructed as follows:

 

switch(geometryType) {

                ...

                case _geometryType.POLYLINE:

                    var json = symbolConfig.Line;

 

 

                    if (json != null)

                        symbol = new _dojo.SimpleLineSymbol(json);

                    else

                        symbol = new _dojo.SimpleLineSymbol();

 

 

                    break;

                ...

            }

 

I add the symbol to my IdentifyTask results and add to the map graphics layer as follows:

 

if (features.constructor === Array)

                _.each(features, function(feature) {

                    feature.setSymbol(Symbols.getSymbol(symbolType, feature.geometry.type));

 

 

                    graphicsLayer.add(feature);

                });

 

The Symbols.getSymbol() method calls the snippet above where the symbol is constructed.  I know this doesn't include everything that happens, so I can add more, but there is quite a lot, so I'm trying to keep it as lean as possible. 

Outcomes