<?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: Clear graphics after queryTask in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/clear-graphics-after-querytask/m-p/731602#M67802</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Never mind.&amp;nbsp; I had a brain freeze.&amp;nbsp; Here is what can clear the graphics when the popup is closed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;&lt;SPAN&gt;watchUtils.whenFalse(view.popup, &lt;/SPAN&gt;&lt;SPAN style="color: #a31515;"&gt;"visible"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; () {&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;view.graphics.removeAll();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;});&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jul 2020 16:59:44 GMT</pubDate>
    <dc:creator>LoriEmerson_McCormack</dc:creator>
    <dc:date>2020-07-24T16:59:44Z</dc:date>
    <item>
      <title>Clear graphics after queryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/clear-graphics-after-querytask/m-p/731601#M67801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do I clear graphics when I close my popup template from a queryTask result?&amp;nbsp; I would expect the symbol to be associated with the "parcelResults" because that is where I set the symbol, but it didn't show in the map until I used the map.add(graphicsLayerParcel).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas;"&gt;function&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas;"&gt; doQueryParcel(paramParcelID) {&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; "&gt;// Clear the results from a previous query&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;graphicsLayerParcel.removeAll();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; paramsQuery.where = &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; "&gt;"PID_NUM = '"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; "&gt; + paramParcelID + &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-family: Consolas; "&gt;"'"&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; "&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; "&gt;// executes the query and calls getResultsParcel() once the promise is resolved&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; "&gt;// promiseRejected() is called if the promise is rejected&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;qTaskParcel.execute(paramsQuery)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;.then(getResultsParcel)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;.catch(promiseRejected);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; } &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; "&gt;// end function doQueryParcel()&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas;"&gt;function&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas;"&gt; getResultsParcel(response) {&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;map.add(response);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; "&gt;// Loop through each of the results and assign a symbol and PopupTemplate&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; "&gt;// to each so they may be visualized on the map&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; "&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; "&gt; parcelResults = response.features.map(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; "&gt;function&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; "&gt; (feature) {&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; "&gt;//var parcelResults = arrayUtils.map(response.features, function (feature) {&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; "&gt;// Sets the symbol of each resulting feature &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;feature.symbol = fillSymbolSingleParcel;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;feature.popupTemplate = tplParcel;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; "&gt;return&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; "&gt; feature;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;});&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;graphicsLayerParcel.addMany(parcelResults);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;map.add(graphicsLayerParcel );&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; "&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; "&gt; parcelExtent = response.features[0].geometry.extent.clone().expand(2);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; "&gt;// animate to the results after they are added to the map&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; view.goTo(parcelExtent).then(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; "&gt;function&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; "&gt; () {&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;view.popup.open({&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;features: parcelResults,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; featureMenuOpen: &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; "&gt;true&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; "&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="font-family: Consolas; "&gt; updateLocationEnabled: &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; "&gt;true&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;});&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;});&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas; "&gt; } &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: small; font-family: Consolas; "&gt;// end function getResultsParcel()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2020 22:00:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/clear-graphics-after-querytask/m-p/731601#M67801</guid>
      <dc:creator>LoriEmerson_McCormack</dc:creator>
      <dc:date>2020-07-22T22:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Clear graphics after queryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/clear-graphics-after-querytask/m-p/731602#M67802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Never mind.&amp;nbsp; I had a brain freeze.&amp;nbsp; Here is what can clear the graphics when the popup is closed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;&lt;SPAN&gt;watchUtils.whenFalse(view.popup, &lt;/SPAN&gt;&lt;SPAN style="color: #a31515;"&gt;"visible"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; () {&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;view.graphics.removeAll();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;});&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jul 2020 16:59:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/clear-graphics-after-querytask/m-p/731602#M67802</guid>
      <dc:creator>LoriEmerson_McCormack</dc:creator>
      <dc:date>2020-07-24T16:59:44Z</dc:date>
    </item>
  </channel>
</rss>

