<?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: Legend Dijit not honoring .setDefinitionExpression from Feature Layer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-dijit-not-honoring-setdefinitionexpression/m-p/511131#M47601</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Robert-&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Essentially you correct thank you..&amp;nbsp; I solved by setting a renderer to match the def query of the feature layer, such that if say hospital points are part of a larger layer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var lyrHospital = new FeatureLayer("https://ags2.scgov.net/arcgis/rest/services/WebEOC/WebEocOperational/MapServer/10", {
&amp;nbsp; mode : FeatureLayer.MODE_ONDEMAND,
&amp;nbsp; opacity : 1.0,
&amp;nbsp; infoTemplate : hspTemplate,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields : outFieldsHospital
&amp;nbsp; });
&amp;nbsp; lyrHospital.setDefinitionExpression("FEATURETYPE = 'HSP'");&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then set the renderer to match:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var hspSym = new PictureMarkerSymbol('http://static.arcgis.com/images/Symbols/NPS/npsPictograph_0074b.png', 18, 18); //24, 24
var hspRenderer = new SimpleRenderer(hspSym); //defaultSymbol, "ProgramArea");
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyrHospital.setRenderer(hspRenderer);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:22:26 GMT</pubDate>
    <dc:creator>DavidColey</dc:creator>
    <dc:date>2021-12-11T22:22:26Z</dc:date>
    <item>
      <title>Legend Dijit not honoring .setDefinitionExpression from Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-dijit-not-honoring-setdefinitionexpression/m-p/511129#M47599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello-&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am pulling a featureLayer out of a larger map service and then setting a Definition Expression to display only the feature I want.&amp;nbsp; Unfortunately, the legend dijit does not honor the definition expression set on the map layer and instead displays all of the symbology from this particular index layer.&amp;nbsp; Does anyone have any suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Apr 2014 19:01:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-dijit-not-honoring-setdefinitionexpression/m-p/511129#M47599</guid>
      <dc:creator>DavidColey</dc:creator>
      <dc:date>2014-04-08T19:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Legend Dijit not honoring .setDefinitionExpression from Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-dijit-not-honoring-setdefinitionexpression/m-p/511130#M47600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A suggestion, haven't tried it, but looking at the API, the Legend has an Optional layerInfos that you can feed in to subset the layers, by default it's all the layers. You may be able to get the layer you've set the definition on, then get it's Renderer, then manually loop through the Renderer to create a new Renderer that matches your layer definition,then update the renderer for that layer and update the layerInfos object. Then when it draws should use your renderer instead of the default one from the server Drawing info.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 17:30:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-dijit-not-honoring-setdefinitionexpression/m-p/511130#M47600</guid>
      <dc:creator>RobWaller</dc:creator>
      <dc:date>2014-04-11T17:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Legend Dijit not honoring .setDefinitionExpression from Feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-dijit-not-honoring-setdefinitionexpression/m-p/511131#M47601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Robert-&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Essentially you correct thank you..&amp;nbsp; I solved by setting a renderer to match the def query of the feature layer, such that if say hospital points are part of a larger layer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var lyrHospital = new FeatureLayer("https://ags2.scgov.net/arcgis/rest/services/WebEOC/WebEocOperational/MapServer/10", {
&amp;nbsp; mode : FeatureLayer.MODE_ONDEMAND,
&amp;nbsp; opacity : 1.0,
&amp;nbsp; infoTemplate : hspTemplate,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields : outFieldsHospital
&amp;nbsp; });
&amp;nbsp; lyrHospital.setDefinitionExpression("FEATURETYPE = 'HSP'");&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then set the renderer to match:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var hspSym = new PictureMarkerSymbol('http://static.arcgis.com/images/Symbols/NPS/npsPictograph_0074b.png', 18, 18); //24, 24
var hspRenderer = new SimpleRenderer(hspSym); //defaultSymbol, "ProgramArea");
&amp;nbsp;&amp;nbsp;&amp;nbsp; lyrHospital.setRenderer(hspRenderer);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:22:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/legend-dijit-not-honoring-setdefinitionexpression/m-p/511131#M47601</guid>
      <dc:creator>DavidColey</dc:creator>
      <dc:date>2021-12-11T22:22:26Z</dc:date>
    </item>
  </channel>
</rss>

