Representing a line feature layer with Markersymbols in ArcGIS JS API

3384
3
12-25-2014 12:37 AM
shabeerali
New Contributor II

I am  setting a scale dependant renderer for a FeatureLayer of line geometry type, so that in samller scale it can shown as a marker symbol and in higher scale it can be shown as a Line symbol. When I tried to apply a SimpleMarkerSymbol to this layer , it is not working. I followed same strategy for a Polygon type feature layer and found it is working perfectly. I am using ArcGIS JS API 3.11

I do not know what is the problem with line feature layer, Can anybody help with a solution.

Thanks

Shabeerali

0 Kudos
3 Replies
ReneRubalcava
Frequent Contributor

This works for polygons, haven't tried with lines though. You can set the renderer to display markers.

JS Bin - Collaborative JavaScript Debugging

var layer = new FeatureLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5", {
  outFields: ["*"],
  infoTemplate: new InfoTemplate("${STATE_NAME}")
});
var markerSym = new SimpleMarkerSymbol();
markerSym.setColor(new Color("#78B378"));
markerSym.setOutline(markerSym.outline.setColor(new Color([133,197,133,0.75])));
var renderer1 = new SimpleRenderer(markerSym); 
layer.setRenderer(ren
0 Kudos
shabeerali
New Contributor II

Already tried for polygons and able to represent with Marker symbols, but for line while I am setting renderer with Markersymbol it not appearing, Can You try your example with line?

0 Kudos
MichalGasparovic
New Contributor III

this is still not working after 4years. Did you resolve it Ali?

0 Kudos