0

Can you please take a look at this demo and let me know why I am not able to add the simple render / Simple Marker to the map for feature layers

<script>
require([
    "esri/map",
    "esri/layers/FeatureLayer",
    "esri/renderers/SimpleRenderer",
    "esri/symbols/SimpleMarkerSymbol", 
    "esri/symbols/SimpleLineSymbol", 
    "esri/Color",
    "dojo/domReady!"
  ],
  function(
    Map,
    FeatureLayer,
    SimpleRenderer,
    SimpleMarkerSymbol,
    SimpleLineSymbol,
    Color,
  ) {

    var map = new Map("map", {
      basemap: "streets",
      center: [-82.44109, 35.6122],
      zoom: 17
    });

    var featureLayer = new FeatureLayer("https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0");

    featureLayer.setRenderer( new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE, 10,
    new Color([0,255,0,0.25])));

    map.addLayer(featureLayer);

  });
</script>
1

You're missing one argument to the SimpleMarkerSymbol. It takes four arguments, not three:

new SimpleMarkerSymbol(style, size, outline, color)

See https://developers.arcgis.com/javascript/3/jsapi/simplemarkersymbol-amd.html#simplemarkersymbol2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.