<?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: Symbology visualisation based on Hit Test  Arcgis Javascript API in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/symbology-visualisation-based-on-hit-test-arcgis/m-p/1258450#M80262</link>
    <description>&lt;P&gt;Are you looking to show the entire layer2 when clicking any point on layer1 ? or just the feature from layer2 that matches with the clicked feature of layer1?&amp;nbsp;&lt;/P&gt;&lt;P&gt;When loading layer2, you could pass inn a definitionexpression (filter) which will always return 0 entries in the beginning. And by clicking on a feature in layer1, you could update that filter based on fields that would match 1-to-1 with the result of the hitTest, making layer2 only show what is returned by the updated filter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layer2 = new FeatureLayer({...., definitionExpression: 'Id = -1'})

const eventRef = view.on('immediate-click', (event) =&amp;gt; {
      const options = {
        include: layer1,
      };

      view.hitTest(event, options).then((response) =&amp;gt; {
        if (!response.results.length) return; // no hit
        const result = response.results[0] as __esri.GraphicHit;
        const primaryKey = result.graphic.attributes['Id'];
        layer2.definitionExpression = $`Id={primaryKey}`
      });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something in the lines of the above i think would work. A bit of pseudo code, so you need to ofcourse adapt it.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Feb 2023 13:47:52 GMT</pubDate>
    <dc:creator>Christer</dc:creator>
    <dc:date>2023-02-15T13:47:52Z</dc:date>
    <item>
      <title>Symbology visualisation based on Hit Test  Arcgis Javascript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/symbology-visualisation-based-on-hit-test-arcgis/m-p/1255777#M80182</link>
      <description>&lt;P&gt;Hi. I have two feature service layers representing same data . One layer is of a simple point symbology(layer1) and another a picture marker symbology(layer2). Two layers are overlayed one over the other&lt;/P&gt;&lt;P&gt;I would like to view the picture marker symbolgy (Layer2) on clicking the point symbology (Layer1).&lt;/P&gt;&lt;P&gt;I read the "Hit Test" content in the developer resources guide. I was unable to find any examples of how to accomplish this. Can anyone offer assistance?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 17:01:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/symbology-visualisation-based-on-hit-test-arcgis/m-p/1255777#M80182</guid>
      <dc:creator>MANESK</dc:creator>
      <dc:date>2023-02-07T17:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Symbology visualisation based on Hit Test  Arcgis Javascript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/symbology-visualisation-based-on-hit-test-arcgis/m-p/1258450#M80262</link>
      <description>&lt;P&gt;Are you looking to show the entire layer2 when clicking any point on layer1 ? or just the feature from layer2 that matches with the clicked feature of layer1?&amp;nbsp;&lt;/P&gt;&lt;P&gt;When loading layer2, you could pass inn a definitionexpression (filter) which will always return 0 entries in the beginning. And by clicking on a feature in layer1, you could update that filter based on fields that would match 1-to-1 with the result of the hitTest, making layer2 only show what is returned by the updated filter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;layer2 = new FeatureLayer({...., definitionExpression: 'Id = -1'})

const eventRef = view.on('immediate-click', (event) =&amp;gt; {
      const options = {
        include: layer1,
      };

      view.hitTest(event, options).then((response) =&amp;gt; {
        if (!response.results.length) return; // no hit
        const result = response.results[0] as __esri.GraphicHit;
        const primaryKey = result.graphic.attributes['Id'];
        layer2.definitionExpression = $`Id={primaryKey}`
      });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something in the lines of the above i think would work. A bit of pseudo code, so you need to ofcourse adapt it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 13:47:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/symbology-visualisation-based-on-hit-test-arcgis/m-p/1258450#M80262</guid>
      <dc:creator>Christer</dc:creator>
      <dc:date>2023-02-15T13:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Symbology visualisation based on Hit Test  Arcgis Javascript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/symbology-visualisation-based-on-hit-test-arcgis/m-p/1258745#M80278</link>
      <description>&lt;P&gt;Thanks Christer for your response.&amp;nbsp; I would like to show the feature from layer2 that matches with the clicked feature of layer 1. I will try with the logic mentioned and work with it.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 23:40:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/symbology-visualisation-based-on-hit-test-arcgis/m-p/1258745#M80278</guid>
      <dc:creator>MANESK</dc:creator>
      <dc:date>2023-02-15T23:40:31Z</dc:date>
    </item>
  </channel>
</rss>

