<?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 do I remove a subset of previously highlighted graphics? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-remove-a-subset-of-previously-highlighted/m-p/482468#M44902</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using a SketchViewModel to draw a polygon around features.&amp;nbsp; The resulting geometry is then used in a query to query the FeatureLayerView.&amp;nbsp; More than 1 feature can be returned in the query results.&amp;nbsp; Currently, I add highlights to all of the resulting graphics.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;featureLayerView.queryFeatures(query).then(function (results) {&lt;BR /&gt; graphics = results.features;&lt;/P&gt;&lt;P&gt;if (graphics.length &amp;gt; 0) {&lt;/P&gt;&lt;P&gt;highlight = featureLayerView.highlight(graphics);&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now need additional functionality to remove previously selected graphics.&amp;nbsp; Scenario, first sketch I highlight 5 graphics.&amp;nbsp; Second sketch I draw a polygon around 3 of the 5 previously highlighted graphics.&amp;nbsp; I'd like the 3 previously highlights removed.&amp;nbsp; How would I go about doing that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My other thought is instead of using a highlight, I would use a client side feature layer in place of a highlight.&amp;nbsp; That way I create the features and on subsequent selections, I can query the feature layer and remove the feature if it is pre-existing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Apr 2019 22:04:51 GMT</pubDate>
    <dc:creator>XongVang</dc:creator>
    <dc:date>2019-04-16T22:04:51Z</dc:date>
    <item>
      <title>How do I remove a subset of previously highlighted graphics?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-remove-a-subset-of-previously-highlighted/m-p/482468#M44902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using a SketchViewModel to draw a polygon around features.&amp;nbsp; The resulting geometry is then used in a query to query the FeatureLayerView.&amp;nbsp; More than 1 feature can be returned in the query results.&amp;nbsp; Currently, I add highlights to all of the resulting graphics.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;featureLayerView.queryFeatures(query).then(function (results) {&lt;BR /&gt; graphics = results.features;&lt;/P&gt;&lt;P&gt;if (graphics.length &amp;gt; 0) {&lt;/P&gt;&lt;P&gt;highlight = featureLayerView.highlight(graphics);&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now need additional functionality to remove previously selected graphics.&amp;nbsp; Scenario, first sketch I highlight 5 graphics.&amp;nbsp; Second sketch I draw a polygon around 3 of the 5 previously highlighted graphics.&amp;nbsp; I'd like the 3 previously highlights removed.&amp;nbsp; How would I go about doing that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My other thought is instead of using a highlight, I would use a client side feature layer in place of a highlight.&amp;nbsp; That way I create the features and on subsequent selections, I can query the feature layer and remove the feature if it is pre-existing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Apr 2019 22:04:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-remove-a-subset-of-previously-highlighted/m-p/482468#M44902</guid>
      <dc:creator>XongVang</dc:creator>
      <dc:date>2019-04-16T22:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove a subset of previously highlighted graphics?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-remove-a-subset-of-previously-highlighted/m-p/482469#M44903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xong,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;The only way to do this that I know of is to maintain an array of previously&amp;nbsp;highlighted graphics as a global variable.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;featureLayerView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;queryFeatures&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;query&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;results&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//Remove the previous highlighted features&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;highlight&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    highlight&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;remove&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
  graphics &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; results&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;features&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//loop through the selected graphics to see if there are any in the previous&lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//highlighted features. If there are then remove them from the previous array&lt;/SPAN&gt;
  graphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;map&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gra&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; index &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; prevGraphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;indexOf&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;gra&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;index &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      prevGraphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;splice&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;index&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;//delete from previous array&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  
  &lt;SPAN class="comment token"&gt;//If there are any graphics in the previous array then use them &lt;/SPAN&gt;
  &lt;SPAN class="comment token"&gt;//else using the new selection&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;prevGraphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;length &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    highlight &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; featureLayerView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;highlight&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    prevGraphics &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; graphics&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    highlight &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; featureLayerView&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;highlight&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;prevGraphics&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:17:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-remove-a-subset-of-previously-highlighted/m-p/482469#M44903</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T21:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I remove a subset of previously highlighted graphics?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-remove-a-subset-of-previously-highlighted/m-p/482470#M44904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great idea.&amp;nbsp; Simply rebuild the highlight from scratch each time using the global graphic array after adding/removing.&amp;nbsp; I was thinking I could do it with the highlight itself, but the handle removal is all or nothing.&amp;nbsp; Everything appears to be working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Robert!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Apr 2019 17:54:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-remove-a-subset-of-previously-highlighted/m-p/482470#M44904</guid>
      <dc:creator>XongVang</dc:creator>
      <dc:date>2019-04-17T17:54:47Z</dc:date>
    </item>
  </channel>
</rss>

