<?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: Displaying feature layer symbol in a custom table of contents in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/displaying-feature-layer-symbol-in-a-custom-table/m-p/299885#M27513</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use &lt;A href="https://developers.arcgis.com/javascript/jsapi/esri.request-amd.html"&gt;esri/request &lt;/A&gt;from the JavaScript API to get legend image urls from the server: &lt;A href="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000pm000000" title="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000pm000000"&gt;ArcGIS REST API&lt;/A&gt;‌ documentation gives more information. Sorry I don't have time to post code but that should help get you started.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Jul 2014 18:44:28 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2014-07-10T18:44:28Z</dc:date>
    <item>
      <title>Displaying feature layer symbol in a custom table of contents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/displaying-feature-layer-symbol-in-a-custom-table/m-p/299884#M27512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have built a custom table of contents similar&amp;nbsp; to the TOC widget &lt;/SPAN&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109&lt;/A&gt;&lt;SPAN&gt;. The only problem I have is how I am going to display the feature layer icon as the legend. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function generateLegend(listOfLayers){ 
 require(["esri/layers/FeatureLayer", "dojo/on"],
 function (FeatureLayer, on) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; //initialazing the feature layer and adding them in a list and on the map
&amp;nbsp; var layerList = [];
&amp;nbsp; for(var i=0; i &amp;lt; listOfLayers.length; i++){
&amp;nbsp;&amp;nbsp; layerList&lt;I&gt; = new FeatureLayer(urlList&lt;I&gt;);
&amp;nbsp;&amp;nbsp; map.addLayer(layerList&lt;I&gt;);
&amp;nbsp; }&amp;nbsp; 

&amp;nbsp; for(var i = 0; i &amp;lt; nameList.length; i++){
&amp;nbsp;&amp;nbsp; var layerId =&amp;nbsp; "Layer" + i; //id for the layer
&amp;nbsp;&amp;nbsp; var layerPostid = "teste" + i; //id for the layer&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; //I also want to display the icon here
&amp;nbsp;&amp;nbsp; //html list to be dispalyed on the browser
&amp;nbsp;&amp;nbsp; layerDisplay += "&amp;lt;li id='" + layerPostid + "'&amp;gt;&amp;lt;input type='checkbox' checked='yes' id=" + layerId + "&amp;gt;" + legendIcon + "&amp;lt;a href='#' id=" + layerId + " onclick='return false;'&amp;gt;" + nameList&lt;I&gt; + "&amp;lt;/a&amp;gt;&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;lt;div class='slider'&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/li&amp;gt;";&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; } 
 
&amp;nbsp; layerDisplay += "&amp;lt;/ul&amp;gt;";&amp;nbsp;&amp;nbsp; 
&amp;nbsp; //displaying the legend 
&amp;nbsp; $("#tocLegend").html(layerDisplay);&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;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas how I could achieve this please?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:23:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/displaying-feature-layer-symbol-in-a-custom-table/m-p/299884#M27512</guid>
      <dc:creator>ChristianDebono</dc:creator>
      <dc:date>2021-12-11T14:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying feature layer symbol in a custom table of contents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/displaying-feature-layer-symbol-in-a-custom-table/m-p/299885#M27513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use &lt;A href="https://developers.arcgis.com/javascript/jsapi/esri.request-amd.html"&gt;esri/request &lt;/A&gt;from the JavaScript API to get legend image urls from the server: &lt;A href="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000pm000000" title="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000pm000000"&gt;ArcGIS REST API&lt;/A&gt;‌ documentation gives more information. Sorry I don't have time to post code but that should help get you started.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 18:44:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/displaying-feature-layer-symbol-in-a-custom-table/m-p/299885#M27513</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-07-10T18:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying feature layer symbol in a custom table of contents</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/displaying-feature-layer-symbol-in-a-custom-table/m-p/299886#M27514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So here is some code...sorry not sure how to format in the new forums:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function legendRequest(mapServerURL, thisLayer2) {&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //mapserverURL is something like "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.server.com/arcgis/rest/services/myMap/MapServer" rel="nofollow" target="_blank"&gt;http://www.server.com/arcgis/rest/services/myMap/MapServer&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var fetchURL = mapServerURL + '/legend/';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Use server requests to get the legend symbol image urls&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var legendRequestPromise = esriRequest({&lt;/P&gt;&lt;P&gt;&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 : fetchURL,&lt;/P&gt;&lt;P&gt;&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; content : {&lt;/P&gt;&lt;P&gt;&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; f : "json"&lt;/P&gt;&lt;P&gt;&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;/P&gt;&lt;P&gt;&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; handleAs : "json"&lt;/P&gt;&lt;P&gt;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; legendRequestPromise.then(function(jsonResults) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(jsonResults);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // If you look at the JSON response in the console you can see where image urls are given&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // layers --&amp;gt; 0 --&amp;gt;legend --&amp;gt; 0 --&amp;gt;url&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Then use these to construct the URL to place in your html divs (format: mapserverURL/layerID/images/imageURL)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }, function(error) {&lt;/P&gt;&lt;P&gt;&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; console.log("Error: ", error.message);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; });&lt;/P&gt;&lt;P&gt; };&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 19:56:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/displaying-feature-layer-symbol-in-a-custom-table/m-p/299886#M27514</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-07-10T19:56:44Z</dc:date>
    </item>
  </channel>
</rss>

