<?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: Intersect on selected polygons in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersect-on-selected-polygons/m-p/433168#M39937</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;AJ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;The FindTask returns a object names "results" the QueryTask Return a object named "featureSet" which has a property called features that is an array of graphics.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Feb 2018 16:40:08 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2018-02-01T16:40:08Z</dc:date>
    <item>
      <title>Intersect on selected polygons</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersect-on-selected-polygons/m-p/433167#M39936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to select multiple polygons with a Query and then pass that into a second spatial query to see what features from&amp;nbsp;subsequent&amp;nbsp;layer they intersect.&amp;nbsp; The output is then a table with the initial polygons and the attributes from the intersected polygon 'joined' to each feature.&amp;nbsp; I am not very proficient with JavaScript and so I found a similar thread and solution posted by Andrew Farrar that was pretty much exactly what I was trying to accomplish (Thank you!).&amp;nbsp; What I have subsequently realized is that he used a FindTask to select the initial feature and then passed that into a spatialquery.&amp;nbsp; My problem is once I got that to work I realized I couldn't select more than one feature&amp;nbsp;with a FindTask and now am trying to substitute in a QueryTask for the FindTask and things aren't working.&amp;nbsp; I am guessing it is because FindTask and QueryTask return differently but I can't figure out how to now pass my results to call the spatialquery.&amp;nbsp; No matter what I try I can't seem to get the attributes to write out even though I can see in the array that I have 5 objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be VERY much appreciated!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Called on each button click&lt;BR /&gt; function doFind() {&lt;/P&gt;&lt;P&gt;var claims = ["P 48582", "P 48581", "P 48580", "P 48579", "P 48578"];&lt;/P&gt;&lt;P&gt;var queryTask = new QueryTask("url");&lt;/P&gt;&lt;P&gt;var query = new Query();&lt;BR /&gt; query.returnGeometry = true;&lt;BR /&gt; query.outFields = [&lt;BR /&gt; "GRANT_NUMBER", "CLAIM_NAME", "CLAIM_LABEL", "TENURE_STATUS", "OWNER_NAME"&lt;BR /&gt; ];&lt;BR /&gt; query.where = "GRANT_NUMBER in ('" + claims.join("','") + "')";&lt;BR /&gt; alert(query.where);&lt;BR /&gt; queryTask.execute(query)&lt;BR /&gt; .then(doGeoQuery)&lt;BR /&gt; .otherwise(rejectedPromise);&lt;BR /&gt; &lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Called if the Promise is Resolved&lt;BR /&gt; function doGeoQuery(results) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Empty the HTML table from previous results&lt;BR /&gt; resultsTable.innerHTML = "";&lt;BR /&gt; // Setup HTML table for new results&lt;BR /&gt; // Set up row for descriptive headers to display results&lt;BR /&gt; var topRow = resultsTable.insertRow(0);&lt;BR /&gt; var cell1 = topRow.insertCell(0);&lt;BR /&gt; var cell2 = topRow.insertCell(1);&lt;BR /&gt; var cell3 = topRow.insertCell(2);&lt;BR /&gt; var cell4 = topRow.insertCell(3);&lt;BR /&gt; var cell5 = topRow.insertCell(4);&lt;BR /&gt; var cell6 = topRow.insertCell(5);&lt;/P&gt;&lt;P&gt;cell1.innerHTML = "&amp;lt;b&amp;gt;Grant Number&amp;lt;/b&amp;gt;";&lt;BR /&gt; cell2.innerHTML = "&amp;lt;b&amp;gt;Claim Name&amp;lt;/b&amp;gt;";&lt;BR /&gt; cell3.innerHTML = "&amp;lt;b&amp;gt;Claim Label&amp;lt;/b&amp;gt;";&lt;BR /&gt; cell4.innerHTML = "&amp;lt;b&amp;gt;Owner&amp;lt;/b&amp;gt;";&lt;BR /&gt; cell5.innerHTML = "&amp;lt;b&amp;gt;Status&amp;lt;/b&amp;gt;";&lt;BR /&gt; cell6.innerHTML = "&amp;lt;b&amp;gt;First Nation Traditional Territory&amp;lt;/b&amp;gt;";&lt;/P&gt;&lt;P&gt;// "response.results" is the data object containing fields and geometry from the found feature&lt;BR /&gt; // empty the array from previous results&lt;BR /&gt; resultsarray = [];&lt;BR /&gt; alert(resultsarray);&lt;BR /&gt; alert(results.features.length);&lt;BR /&gt; //var results = response.results;&lt;BR /&gt; // If no results are returned from the FindTask "find", notify the user&lt;BR /&gt; if (results.features.length === 0) {&lt;BR /&gt; resultsTable.innerHTML = "&amp;lt;i&amp;gt;No results found&amp;lt;/i&amp;gt;";&lt;BR /&gt; return;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;// array.forEach(results, function(feature) {&lt;BR /&gt; // Performs Spatial Query and writes results for each result returned&amp;nbsp;&lt;BR /&gt; arrayUtils.forEach(featureSet.features, function(feature, i) {&lt;BR /&gt; // Get each value of the desired attributes from the FindTask "find"&lt;BR /&gt; var geo = feature.geometry;&lt;BR /&gt; var grNum = feature.attributes.GRANT_NUMBER;&lt;BR /&gt; var clNam = feature.attributes.CLAIM_NAME;&lt;BR /&gt; var clLab = feature.attributes.CLAIM_LABEL;&lt;BR /&gt; var owner = feature.attributes.OWNER_NAME;&lt;BR /&gt; var tnStat = feature.attributes.TENURE_STATUS;&lt;/P&gt;&lt;P&gt;//Setup Spatial Query&lt;BR /&gt; var spatialquery = new Query();&lt;BR /&gt; spatialquery.outFields = ["FNTT"];&lt;BR /&gt; spatialquery.geometry = geo;&lt;BR /&gt; spatialquery.spatialRelationship = "intersects";&lt;/P&gt;&lt;P&gt;// execute QueryTask for Spatial Query&lt;BR /&gt; qt.execute(spatialquery).then(function(spatialresults) {&lt;BR /&gt; // grab attribute from spatial query&lt;BR /&gt; var FNTT = spatialresults.features[0].attributes.FNTT;&lt;BR /&gt; //push results to array&lt;BR /&gt; resultsarray.push(grNum);&lt;BR /&gt; resultsarray.push(clNam);&lt;BR /&gt; resultsarray.push(clLab);&lt;BR /&gt; resultsarray.push(owner);&lt;BR /&gt; resultsarray.push(tnStat);&lt;BR /&gt; resultsarray.push(FNTT);&lt;BR /&gt; &lt;BR /&gt; // If no results are returned from the task, notify the user&lt;BR /&gt; if (resultsarray.length === 0) {&lt;BR /&gt; resultsTable.innerHTML = "&amp;lt;i&amp;gt;No results found&amp;lt;/i&amp;gt;";&lt;BR /&gt; return;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;// Write html table underneath header row&lt;BR /&gt; var i = 1;&lt;BR /&gt; // Add each resulting value to the table as a new row, and create cells&lt;BR /&gt; var row = resultsTable.insertRow(i);&lt;BR /&gt; var cell1 = row.insertCell(0);&lt;BR /&gt; var cell2 = row.insertCell(1);&lt;BR /&gt; var cell3 = row.insertCell(2);&lt;BR /&gt; var cell4 = row.insertCell(3);&lt;BR /&gt; var cell5 = row.insertCell(4);&lt;BR /&gt; var cell6 = row.insertCell(5);&lt;BR /&gt; &lt;BR /&gt; // Assign values to cells&lt;BR /&gt; cell1.innerHTML = grNum;&lt;BR /&gt; cell2.innerHTML = clNam;&lt;BR /&gt; cell3.innerHTML = clLab;&lt;BR /&gt; cell4.innerHTML = owner;&lt;BR /&gt; cell5.innerHTML = tnStat;&lt;BR /&gt; cell6.innerHTML = FNTT;&lt;BR /&gt; &lt;BR /&gt; //Increase array counter&lt;BR /&gt; i++;&lt;BR /&gt; })&lt;BR /&gt; });&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;// Assign results table to the html table by ID&lt;BR /&gt; var resultsTable = dom.byId("tblResults");&lt;/P&gt;&lt;P&gt;// Executes each time the promise is rejected.&lt;BR /&gt; function rejectedPromise(err) {&lt;BR /&gt; console.error("Promise didn't resolve: ", err.message);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;// methods to execute the function&lt;BR /&gt; // Run doFind() when button is clicked&lt;BR /&gt; on(dom.byId("btnFind"), "click", doFind);&lt;/P&gt;&lt;P&gt;// "Clicks" btnFind when "Enter" is pressed on keyboard, thereby running doFind()&lt;BR /&gt; document.getElementById('grantNumber').addEventListener('keypress', function(event) {&lt;BR /&gt; if (event.keyCode == 13) {&lt;BR /&gt; document.getElementById('btnFind').click();&lt;BR /&gt; }&lt;BR /&gt; });&lt;BR /&gt; });&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jan 2018 21:56:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersect-on-selected-polygons/m-p/433167#M39936</guid>
      <dc:creator>AJRS</dc:creator>
      <dc:date>2018-01-31T21:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Intersect on selected polygons</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersect-on-selected-polygons/m-p/433168#M39937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;AJ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;The FindTask returns a object names "results" the QueryTask Return a object named "featureSet" which has a property called features that is an array of graphics.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2018 16:40:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersect-on-selected-polygons/m-p/433168#M39937</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-02-01T16:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: Intersect on selected polygons</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersect-on-selected-polygons/m-p/433169#M39938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response.&amp;nbsp; I am assuming that means I'll have arrays of arrays which is definitely out of my area of expertise.&amp;nbsp; I definitely need to take a JavaScript course!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Feb 2018 17:40:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersect-on-selected-polygons/m-p/433169#M39938</guid>
      <dc:creator>AJRS</dc:creator>
      <dc:date>2018-02-13T17:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: Intersect on selected polygons</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersect-on-selected-polygons/m-p/433170#M39939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;AJ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;No the name of the returned object is just different based on the task that you use (that was my main point) a FeatureSet is just an array of Graphics.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Feb 2018 17:46:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/intersect-on-selected-polygons/m-p/433170#M39939</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-02-13T17:46:42Z</dc:date>
    </item>
  </channel>
</rss>

