<?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 How to get style, symbol or color from a feature? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-style-symbol-or-color-from-a-feature/m-p/1228550#M79243</link>
    <description>&lt;P&gt;Good Day&lt;BR /&gt;&lt;BR /&gt;I have a layer that which uses a valueExpression in the Unique Value Renderer to set it's style, giving me something like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndrewMurdoch1_0-1667512621210.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/55241i73407E2B264032B5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndrewMurdoch1_0-1667512621210.png" alt="AndrewMurdoch1_0-1667512621210.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm running into a problem where I need to know what colours / uniqueValueInfo from the Unique Value Renderer was set on to the map.&amp;nbsp; How can I get this information?&amp;nbsp; I tried running a query:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;queryAllFeatures(layer: FeatureLayer): Promise&amp;lt;Graphic[] | Error&amp;gt; {
    return new Promise((r, j) =&amp;gt; {
      const query = {
        where: '1=1',
        outFields: ['*'],
        returnGeometry: true
      }

      layer.queryFeatures(query).then((queryRes) =&amp;gt; {
        r(queryRes.features);
      }).catch((error) =&amp;gt; {
        console.log(error);
        j(null);
      })
    });
  }&lt;/LI-CODE&gt;&lt;P&gt;But I can't seem to find the information in the output?&amp;nbsp; I&amp;nbsp; would imagine it's trivial to get the style information form the layer.&amp;nbsp; Ideally I'd like to get a list of all styles / colours that are active.&lt;BR /&gt;&lt;BR /&gt;Is this possible?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2022 21:59:17 GMT</pubDate>
    <dc:creator>AndrewMurdoch1</dc:creator>
    <dc:date>2022-11-03T21:59:17Z</dc:date>
    <item>
      <title>How to get style, symbol or color from a feature?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-style-symbol-or-color-from-a-feature/m-p/1228550#M79243</link>
      <description>&lt;P&gt;Good Day&lt;BR /&gt;&lt;BR /&gt;I have a layer that which uses a valueExpression in the Unique Value Renderer to set it's style, giving me something like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndrewMurdoch1_0-1667512621210.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/55241i73407E2B264032B5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndrewMurdoch1_0-1667512621210.png" alt="AndrewMurdoch1_0-1667512621210.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm running into a problem where I need to know what colours / uniqueValueInfo from the Unique Value Renderer was set on to the map.&amp;nbsp; How can I get this information?&amp;nbsp; I tried running a query:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;queryAllFeatures(layer: FeatureLayer): Promise&amp;lt;Graphic[] | Error&amp;gt; {
    return new Promise((r, j) =&amp;gt; {
      const query = {
        where: '1=1',
        outFields: ['*'],
        returnGeometry: true
      }

      layer.queryFeatures(query).then((queryRes) =&amp;gt; {
        r(queryRes.features);
      }).catch((error) =&amp;gt; {
        console.log(error);
        j(null);
      })
    });
  }&lt;/LI-CODE&gt;&lt;P&gt;But I can't seem to find the information in the output?&amp;nbsp; I&amp;nbsp; would imagine it's trivial to get the style information form the layer.&amp;nbsp; Ideally I'd like to get a list of all styles / colours that are active.&lt;BR /&gt;&lt;BR /&gt;Is this possible?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 21:59:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-style-symbol-or-color-from-a-feature/m-p/1228550#M79243</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2022-11-03T21:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get style, symbol or color from a feature?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-style-symbol-or-color-from-a-feature/m-p/1228864#M79247</link>
      <description>&lt;P&gt;If I'm understanding your question properly, it seems to me that UniqueValueRenderer.&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html#getUniqueValueInfo" target="_self"&gt;getUniqueValueInfo&lt;/A&gt; is the key to what you're trying to do.&amp;nbsp; For example:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layer.renderer.getUniqueValueInfo(someGraphic).then(function(uniqueValueInfo) {
	var symbol = uniqueValueInfo.symbol;
	//do whatever with the symbology for "someGraphic" here
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 18:47:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-style-symbol-or-color-from-a-feature/m-p/1228864#M79247</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-11-04T18:47:27Z</dc:date>
    </item>
  </channel>
</rss>

