<?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: Duplicate items in the legend (picture included) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/duplicate-items-in-the-legend-picture-included/m-p/144373#M13429</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;since you are relying on the 'onLayersAddResult' event to create your layerInfos object to pass in the legend widget constructor it would be helpful to know which specific layers in your application you are loading with map.addLayer() and which you are loading using map.addLayers([])&lt;BR /&gt;&lt;BR /&gt;also, id be curious to know what the layerInfo you are passing to the legend widget contains.&amp;nbsp; can you set a breakpoint and take a look?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your reply, John.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's only one instance in the entirety of my code where I add layers to the map. It's within a function I that also declares the infotemplate, a feature layer, and a dynamic map service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I use:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt; myMap.addLayers([featureLayer1, DMSL_StudyArea]);&lt;/PRE&gt;&lt;SPAN&gt; to add the feature layer and the dynamic map service to the map. The symbology classes in the feature layer are the ones being duplicated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Jul 2013 20:24:54 GMT</pubDate>
    <dc:creator>RuchiraWelikala</dc:creator>
    <dc:date>2013-07-15T20:24:54Z</dc:date>
    <item>
      <title>Duplicate items in the legend (picture included)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/duplicate-items-in-the-legend-picture-included/m-p/144371#M13427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have recently created a web map that uses the legend snippet from the ESRI JavaScript API website.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jssamples/widget_legend.html" rel="nofollow noopener noreferrer" target="_blank"&gt;https://developers.arcgis.com/en/javascript/jssamples/widget_legend.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It works great for the most part, but has one issue, there are duplicate entries in the legend. (Refer to this image: [ATTACH=CONFIG]25925[/ATTACH])The rest services that I am using are all symbolized properly without duplicates. The method I'm using to add the services to the map is through a feature layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the exact code in my .js file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.connect(myMap, 'onLayersAddResult', function (results) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var layerInfo = dojo.map(results, function (layer, index) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return { layer: layer.layer, title: layer.layer.name };
&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; if (layerInfo.length &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var legendDijit = new esri.dijit.Legend({
&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; map: myMap,
&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; layerInfos: layerInfo},
&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; "legendDiv");
&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; legendDijit.startup();
&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; });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any information would help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:54:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/duplicate-items-in-the-legend-picture-included/m-p/144371#M13427</guid>
      <dc:creator>RuchiraWelikala</dc:creator>
      <dc:date>2021-12-11T07:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate items in the legend (picture included)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/duplicate-items-in-the-legend-picture-included/m-p/144372#M13428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;since you are relying on the 'onLayersAddResult' event to create your layerInfos object to pass in the legend widget constructor it would be helpful to know which specific layers in your application you are loading with map.addLayer() and which you are loading using map.addLayers([])&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;also, id be curious to know what the layerInfo you are passing to the legend widget contains.&amp;nbsp; can you set a breakpoint and take a look?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 16:01:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/duplicate-items-in-the-legend-picture-included/m-p/144372#M13428</guid>
      <dc:creator>JohnGravois</dc:creator>
      <dc:date>2013-07-15T16:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate items in the legend (picture included)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/duplicate-items-in-the-legend-picture-included/m-p/144373#M13429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;since you are relying on the 'onLayersAddResult' event to create your layerInfos object to pass in the legend widget constructor it would be helpful to know which specific layers in your application you are loading with map.addLayer() and which you are loading using map.addLayers([])&lt;BR /&gt;&lt;BR /&gt;also, id be curious to know what the layerInfo you are passing to the legend widget contains.&amp;nbsp; can you set a breakpoint and take a look?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your reply, John.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's only one instance in the entirety of my code where I add layers to the map. It's within a function I that also declares the infotemplate, a feature layer, and a dynamic map service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I use:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt; myMap.addLayers([featureLayer1, DMSL_StudyArea]);&lt;/PRE&gt;&lt;SPAN&gt; to add the feature layer and the dynamic map service to the map. The symbology classes in the feature layer are the ones being duplicated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 20:24:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/duplicate-items-in-the-legend-picture-included/m-p/144373#M13429</guid>
      <dc:creator>RuchiraWelikala</dc:creator>
      <dc:date>2013-07-15T20:24:54Z</dc:date>
    </item>
  </channel>
</rss>

