<?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: HitTest able to select a feature with isn't visible in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-able-to-select-a-feature-with-isn-t/m-p/1105254#M74894</link>
    <description>&lt;P&gt;Maybe you could maintain a list of the loaded map feature layers, then if one is changed to have a transparency set to 0 you could remove it from this list (until it was set back I'm guessing).&amp;nbsp; Then when you called the query function you could check this list and not perform the query if the feature layer wasn't in it.&amp;nbsp; It just seems that if you control when a layer's transparency is turned off, then you should be able to track that and know which layers not to use in the query.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Oct 2021 16:50:16 GMT</pubDate>
    <dc:creator>JeffreyWilkerson</dc:creator>
    <dc:date>2021-10-06T16:50:16Z</dc:date>
    <item>
      <title>HitTest able to select a feature with isn't visible</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-able-to-select-a-feature-with-isn-t/m-p/1105249#M74893</link>
      <description>&lt;P&gt;Good Day&lt;BR /&gt;&lt;BR /&gt;I have a map with many layers on it, when I turned off a layer by setting opacity to 0 in the feature query:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;if &lt;/SPAN&gt;(featureQuery.&lt;SPAN&gt;length &lt;/SPAN&gt;&amp;gt; &lt;SPAN&gt;0&lt;/SPAN&gt;) {&lt;BR /&gt;  &lt;SPAN&gt;this&lt;/SPAN&gt;.&lt;SPAN&gt;_view&lt;/SPAN&gt;.&lt;SPAN&gt;whenLayerView&lt;/SPAN&gt;(&lt;SPAN&gt;this&lt;/SPAN&gt;.&lt;SPAN&gt;_layers&lt;/SPAN&gt;[prop][innerProp]).&lt;SPAN&gt;then&lt;/SPAN&gt;((featureLayerView) =&amp;gt; {&lt;BR /&gt;    featureLayerView.&lt;SPAN&gt;effect &lt;/SPAN&gt;= {&lt;BR /&gt;      &lt;SPAN&gt;filter&lt;/SPAN&gt;: {&lt;BR /&gt;        &lt;SPAN&gt;where&lt;/SPAN&gt;: featureQuery&lt;BR /&gt;      }&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;      &lt;SPAN&gt;excludedEffect&lt;/SPAN&gt;: &lt;SPAN&gt;'opacity(0%)'&lt;BR /&gt;&lt;/SPAN&gt;    }&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;  })&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;} &lt;SPAN&gt;else &lt;/SPAN&gt;{&lt;BR /&gt;  &lt;SPAN&gt;this&lt;/SPAN&gt;.&lt;SPAN&gt;_layers&lt;/SPAN&gt;[prop][innerProp].&lt;SPAN&gt;visible &lt;/SPAN&gt;= &lt;SPAN&gt;false;&lt;BR /&gt;&lt;/SPAN&gt;}&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;the layer disappears, but I'm still able to select the feature, the circle is not visible on the map&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndrewMurdoch1_0-1633535532542.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24653i541C84EE82889A05/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndrewMurdoch1_0-1633535532542.png" alt="AndrewMurdoch1_0-1633535532542.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm using ArcGIS Core 4.20.2, I'm doing a hittest to pick up the feature clicked, is there away to filter out features which aren't visible, or have an opacity of 0?&lt;BR /&gt;&lt;BR /&gt;This is the main part of my query function:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;try &lt;/SPAN&gt;{&lt;BR /&gt;  &lt;SPAN&gt;if &lt;/SPAN&gt;(&lt;SPAN&gt;this&lt;/SPAN&gt;.&lt;SPAN&gt;_layers&lt;/SPAN&gt;[prop][geometryProp]) {&lt;BR /&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;(&lt;SPAN&gt;this&lt;/SPAN&gt;.&lt;SPAN&gt;_layers&lt;/SPAN&gt;[prop][geometryProp].&lt;SPAN&gt;visible&lt;/SPAN&gt;) {&lt;BR /&gt;      &lt;SPAN&gt;if &lt;/SPAN&gt;(&lt;SPAN&gt;typeof this&lt;/SPAN&gt;.&lt;SPAN&gt;_layers&lt;/SPAN&gt;[prop][geometryProp].&lt;SPAN&gt;createQuery &lt;/SPAN&gt;=== &lt;SPAN&gt;'function'&lt;/SPAN&gt;) {&lt;BR /&gt;        &lt;SPAN&gt;const &lt;/SPAN&gt;query = &lt;SPAN&gt;this&lt;/SPAN&gt;.&lt;SPAN&gt;_layers&lt;/SPAN&gt;[prop][geometryProp].&lt;SPAN&gt;createQuery&lt;/SPAN&gt;()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;        query.&lt;SPAN&gt;where &lt;/SPAN&gt;= &lt;SPAN&gt;'ObjectID = ' &lt;/SPAN&gt;+ objectId&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;        query.&lt;SPAN&gt;outFields &lt;/SPAN&gt;= [&lt;SPAN&gt;'*'&lt;/SPAN&gt;]&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;        query.&lt;SPAN&gt;returnGeometry &lt;/SPAN&gt;= geometry&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;        this&lt;/SPAN&gt;.&lt;SPAN&gt;_layers&lt;/SPAN&gt;[prop][geometryProp].&lt;SPAN&gt;queryFeatures&lt;/SPAN&gt;(query).&lt;SPAN&gt;then&lt;/SPAN&gt;((queryRes) =&amp;gt; {&lt;BR /&gt;          queryRes.&lt;SPAN&gt;features&lt;/SPAN&gt;.&lt;SPAN&gt;map&lt;/SPAN&gt;((feature) =&amp;gt; {&lt;BR /&gt;            &lt;SPAN&gt;if &lt;/SPAN&gt;(geometry) {&lt;BR /&gt;              &lt;SPAN&gt;if &lt;/SPAN&gt;(feature.&lt;SPAN&gt;geometry&lt;/SPAN&gt;) {&lt;BR /&gt;                r(feature.&lt;SPAN&gt;geometry&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;              }&lt;BR /&gt;            } &lt;SPAN&gt;else &lt;/SPAN&gt;{&lt;BR /&gt;              &lt;SPAN&gt;if &lt;/SPAN&gt;(feature) {&lt;BR /&gt;                r(feature)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;              }&lt;BR /&gt;            }&lt;BR /&gt;          })&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;        })&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;      }&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;} &lt;SPAN&gt;catch &lt;/SPAN&gt;(error) {&lt;BR /&gt;  &lt;SPAN&gt;console&lt;/SPAN&gt;.&lt;SPAN&gt;log&lt;/SPAN&gt;(error)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 16:37:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-able-to-select-a-feature-with-isn-t/m-p/1105249#M74893</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-10-06T16:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: HitTest able to select a feature with isn't visible</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-able-to-select-a-feature-with-isn-t/m-p/1105254#M74894</link>
      <description>&lt;P&gt;Maybe you could maintain a list of the loaded map feature layers, then if one is changed to have a transparency set to 0 you could remove it from this list (until it was set back I'm guessing).&amp;nbsp; Then when you called the query function you could check this list and not perform the query if the feature layer wasn't in it.&amp;nbsp; It just seems that if you control when a layer's transparency is turned off, then you should be able to track that and know which layers not to use in the query.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 16:50:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-able-to-select-a-feature-with-isn-t/m-p/1105254#M74894</guid>
      <dc:creator>JeffreyWilkerson</dc:creator>
      <dc:date>2021-10-06T16:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: HitTest able to select a feature with isn't visible</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-able-to-select-a-feature-with-isn-t/m-p/1105278#M74896</link>
      <description>&lt;P&gt;Thanks for the suggestion, I actually solved it by using .filter instead of .effect&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;featureLayerView.&lt;SPAN&gt;filter &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;FeatureFilter({&lt;BR /&gt;  &lt;SPAN&gt;where&lt;/SPAN&gt;: featureQuery&lt;BR /&gt;})&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;If anyone else runs into this problem, trying using a Feature Filter instead...&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 17:56:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hittest-able-to-select-a-feature-with-isn-t/m-p/1105278#M74896</guid>
      <dc:creator>AndrewMurdoch1</dc:creator>
      <dc:date>2021-10-06T17:56:50Z</dc:date>
    </item>
  </channel>
</rss>

