<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FeatureLayer FeatureCollection Unique renderer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-featurecollection-unique-renderer/m-p/616039#M57565</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you create your featureLayer from your featureCollection, try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var defaultSymbol = new SimpleMarkerSymbol().setStyle(SimpleMarkerSymbol.STYLE_CIRCLE);
defaultSymbol.setColor(new Color([255, 0, 0, 0.25]));
defaultSymbol.setSize("4.2");

var renderer = new UniqueValueRenderer(defaultSymbol, "symbolField");
renderer.addValue("0", new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 6, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0, 0.75]), 1), new Color([255, 0, 0, 0.5])));
renderer.addValue("1", new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 6, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 71, 171, 0.75]), 1), new Color([0, 71, 171, 0.5])));

featureLayer.setRenderer(renderer);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my example, I have a field named "symbolField" in a point featureLayer with either a "0" or "1" value. Based on these values, either a blue or red symbol renders in the map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:20:11 GMT</pubDate>
    <dc:creator>ChrisSmith7</dc:creator>
    <dc:date>2021-12-12T02:20:11Z</dc:date>
    <item>
      <title>FeatureLayer FeatureCollection Unique renderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-featurecollection-unique-renderer/m-p/616038#M57564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a feature layer created from a feature collection similar to the &lt;A href="https://developers.arcgis.com/javascript/jssamples/fl_featureCollection.html" rel="nofollow noopener noreferrer" target="_blank"&gt;sample&lt;/A&gt;.&amp;nbsp; It works great:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var featureCollection = {
&amp;nbsp;&amp;nbsp;&amp;nbsp; "layerDefinition": null,
&amp;nbsp;&amp;nbsp;&amp;nbsp; "featureSet": {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "features": [],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "geometryType": "esriGeometryPoint"
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
};

featureCollection.layerDefinition = {
&amp;nbsp;&amp;nbsp;&amp;nbsp; "geometryType": "esriGeometryPoint",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "objectIdField": "ObjectID",
&amp;nbsp;&amp;nbsp;&amp;nbsp; "drawingInfo": {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "renderer": {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "type": "simple",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "symbol": {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "type": "esriPMS",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "url": "resources/images/ship.png",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "contentType": "image/png",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "width": 16,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "height": 16
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp;&amp;nbsp; "fields": [{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "name": "ObjectID",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "alias": "ObjectID",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeOID"
&amp;nbsp;&amp;nbsp;&amp;nbsp; }, {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "name": "description",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "alias": "Description",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeString"
&amp;nbsp;&amp;nbsp;&amp;nbsp; }, {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "name": "title",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "alias": "Title",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "type": "esriFieldTypeString"
&amp;nbsp;&amp;nbsp;&amp;nbsp; }]
};&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd now like to change this from a simple renderer to a unique value renderer.&amp;nbsp; Does anyone have an example that can get me started?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:20:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-featurecollection-unique-renderer/m-p/616038#M57564</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2021-12-12T02:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer FeatureCollection Unique renderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-featurecollection-unique-renderer/m-p/616039#M57565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you create your featureLayer from your featureCollection, try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var defaultSymbol = new SimpleMarkerSymbol().setStyle(SimpleMarkerSymbol.STYLE_CIRCLE);
defaultSymbol.setColor(new Color([255, 0, 0, 0.25]));
defaultSymbol.setSize("4.2");

var renderer = new UniqueValueRenderer(defaultSymbol, "symbolField");
renderer.addValue("0", new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 6, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0, 0.75]), 1), new Color([255, 0, 0, 0.5])));
renderer.addValue("1", new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 6, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 71, 171, 0.75]), 1), new Color([0, 71, 171, 0.5])));

featureLayer.setRenderer(renderer);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my example, I have a field named "symbolField" in a point featureLayer with either a "0" or "1" value. Based on these values, either a blue or red symbol renders in the map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:20:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-featurecollection-unique-renderer/m-p/616039#M57565</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2021-12-12T02:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer FeatureCollection Unique renderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-featurecollection-unique-renderer/m-p/616040#M57566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Worked like a charm, thanks Chris.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 16:31:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-featurecollection-unique-renderer/m-p/616040#M57566</guid>
      <dc:creator>GlenReid</dc:creator>
      <dc:date>2016-01-28T16:31:26Z</dc:date>
    </item>
  </channel>
</rss>

